public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-08-14 14:56 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-08-14 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     c818d4db610151232190c108ecc9f3ed3aa5284c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug 13 12:11:59 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug 13 12:11:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c818d4db

file/mako_templates: env.txt, env.html

mako templates for testing status report generation.

---
 files/mako_templates/env.html | 15 +++++++++++++++
 files/mako_templates/env.txt  |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/files/mako_templates/env.html b/files/mako_templates/env.html
new file mode 100644
index 0000000..419c429
--- /dev/null
+++ b/files/mako_templates/env.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+   "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+   <title>roverlay env dump</title>
+</head>
+<body>
+   <H3>environment variables:</H3>
+   <UL>
+   % for key, value in dictref().sorted_env_vars():
+      <LI>${key|h}=&quot;${value|h}&quot;</LI>
+   % endfor
+   </UL>
+</body>
+</html>

diff --git a/files/mako_templates/env.txt b/files/mako_templates/env.txt
new file mode 100644
index 0000000..874074f
--- /dev/null
+++ b/files/mako_templates/env.txt
@@ -0,0 +1,3 @@
+% for key, value in dictref().sorted_env_vars():
+${key}="${value}"
+% endfor


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-08-16 10:43 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-08-16 10:43 UTC (permalink / raw
  To: gentoo-commits

commit:     c54e40967352102d69f3580730b06306fd125146
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 16 10:29:17 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 16 10:29:17 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c54e4096

files/: templates for status report generation

---
 files/mako_templates/status.html | 64 ++++++++++++++++++++++++++
 files/mako_templates/status.txt  | 98 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 162 insertions(+)

diff --git a/files/mako_templates/status.html b/files/mako_templates/status.html
new file mode 100644
index 0000000..ed6fecd
--- /dev/null
+++ b/files/mako_templates/status.html
@@ -0,0 +1,64 @@
+## -*- coding: utf-8 -*-
+<%page expression_filter="unicode,h"/>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+   "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<style type='text/css'>
+.status_ok {
+   color: #000000;
+}
+.status_warn {
+   color: #e09000;
+}
+.status_err {
+   color: #d00000;
+}
+.status_crit {
+   color: #d00000;
+}
+</style>
+<head>
+   <title>R overlay status</title>
+</head>
+<body>
+% if 'STATS_DB' in dictref():
+   <H3>status</H3>
+   <TABLE cellpadding=5>
+   <TR>
+      <TH>name</TH>
+      <TH>value</TH>
+      <TH>description</TH>
+   </TR>
+   % for key, stats in STATS_DB:
+   <TR class="status_${stats.get_word()}">
+      <TD>${key}</TD>
+      <TD>${stats.value}</TD>
+      <TD>${stats.description}</TD>
+   </TR>
+   % endfor
+   </TABLE>
+   % if STATS_DB.make_suggestions(pure_text=False):
+      <H3>Suggestions/Notes</H3>
+      <UL>
+      % for topic, details in STATS_DB.suggestions:
+         % if details:
+         <LI>
+            ${topic|n,unicode}
+            <UL>
+            % for detail in details:
+               <LI>${detail|n,unicode}</LI>
+            % endfor
+            </UL>
+            </LI>
+         % else:
+         <LI>${topic|n,unicode}</LI>
+         % endif
+      % endfor
+      </UL>
+   % endif
+% else:
+   <H3 class="status_crit">no stats available</FONT></H3>
+% endif
+</body>
+</html>

diff --git a/files/mako_templates/status.txt b/files/mako_templates/status.txt
new file mode 100644
index 0000000..e511756
--- /dev/null
+++ b/files/mako_templates/status.txt
@@ -0,0 +1,98 @@
+## -*- coding: utf-8 -*-
+<%!
+   import textwrap
+
+   HEADER_WORDS = {
+      'status'      : " ",
+      'name'        : " name",
+      'value'       : " value",
+      'description' : " description"
+   }
+
+   SUGGESTIONS_WRAPPER = textwrap.TextWrapper (
+      subsequent_indent=(4*' '), break_long_words=False
+   )
+%>
+
+% if 'STATS_DB' in dictref():
+% if STATS_DB.values:
+<%
+   max_col_width = [
+      len(HEADER_WORDS[key]) for key in (
+         "status", "name", "value", "description"
+      )
+   ]
+
+   line_components = [
+      (
+         stats.get_word ( "OK  ", "WARN", "ERR ", "CRIT" ),
+         str(key), str(stats.value), str(stats.description)
+      )
+      for key, stats in STATS_DB
+   ]
+
+   for words in line_components:
+      for index, word in enumerate ( words ):
+         wlen = len ( word )
+         if wlen > max_col_width[index]:
+            max_col_width[index] = wlen
+
+   col_format = lambda fmt, **kw: fmt.format (
+      l_status=max_col_width[0], l_name=max_col_width[1],
+      l_value=max_col_width[2], l_description=max_col_width[3],
+      **kw
+   )
+
+
+   status_fmt = lambda **kw: col_format (
+      "{status:<{l_status}}  {name:<{l_name}}  {value:<{l_value}}", **kw
+   )
+   status_header = status_fmt ( **HEADER_WORDS )
+   status_lines  = [
+      status_fmt ( status=status, name=name, value=value )
+      for status, name, value, description in line_components
+   ]
+
+   desc_fmt = lambda **kw: col_format (
+      "{name:<{l_name}} {description:<{l_description}}", **kw
+   )
+   desc_header = desc_fmt ( **HEADER_WORDS )
+   desc_lines  = [
+      desc_fmt ( name=name, description=description )
+      for status, name, value, description in line_components
+   ]
+
+
+%>
+${status_header}
+% for line in status_lines:
+${line}
+% endfor
+
+
+${desc_header}
+% for line in desc_lines:
+${line}
+% endfor
+%endif
+##
+##
+% if STATS_DB.make_suggestions(pure_text=True):
+
+
+Suggestions/Notes:
+
+% for topic, details in STATS_DB.suggestions:
+##
+* ${SUGGESTIONS_WRAPPER.fill(topic)}
+% for detail in details or ():
+-> ${SUGGESTIONS_WRAPPER.fill(detail)}
+% endfor
+##
+% endfor
+##
+% endif
+##
+% else:
+cannot get status - database not available.
+% endif


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-08-16 10:43 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-08-16 10:43 UTC (permalink / raw
  To: gentoo-commits

commit:     b0d32862ef77d704deff1317a2b3fe947cb402d8
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 16 10:28:37 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 16 10:28:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b0d32862

files/mako_templates/env: add 'coding utf-8' comment

---
 files/mako_templates/env.html | 4 +++-
 files/mako_templates/env.txt  | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/files/mako_templates/env.html b/files/mako_templates/env.html
index 419c429..09e8c51 100644
--- a/files/mako_templates/env.html
+++ b/files/mako_templates/env.html
@@ -1,3 +1,5 @@
+## -*- coding: utf-8 -*-
+<%page expression_filter="unicode,h"/>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
 <html>
@@ -8,7 +10,7 @@
    <H3>environment variables:</H3>
    <UL>
    % for key, value in dictref().sorted_env_vars():
-      <LI>${key|h}=&quot;${value|h}&quot;</LI>
+      <LI>${key}=&quot;${value}&quot;</LI>
    % endfor
    </UL>
 </body>

diff --git a/files/mako_templates/env.txt b/files/mako_templates/env.txt
index 874074f..ac3ded8 100644
--- a/files/mako_templates/env.txt
+++ b/files/mako_templates/env.txt
@@ -1,3 +1,4 @@
+## -*- coding: utf-8 -*-
 % for key, value in dictref().sorted_env_vars():
 ${key}="${value}"
 % endfor


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-08-16 12:42 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-08-16 12:42 UTC (permalink / raw
  To: gentoo-commits

commit:     3fcfa288c0e13b46bede7f4e0d17f80338a683e6
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 16 12:41:32 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 16 12:41:32 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=3fcfa288

files/mako_templates/status: handle UNKNOWNs

---
 files/mako_templates/status.html | 3 +++
 files/mako_templates/status.txt  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/files/mako_templates/status.html b/files/mako_templates/status.html
index ed6fecd..777ea43 100644
--- a/files/mako_templates/status.html
+++ b/files/mako_templates/status.html
@@ -17,6 +17,9 @@
 .status_crit {
    color: #d00000;
 }
+.status_undef {
+   color: #000080;
+}
 </style>
 <head>
    <title>R overlay status</title>

diff --git a/files/mako_templates/status.txt b/files/mako_templates/status.txt
index e511756..b6215d9 100644
--- a/files/mako_templates/status.txt
+++ b/files/mako_templates/status.txt
@@ -25,7 +25,7 @@
 
    line_components = [
       (
-         stats.get_word ( "OK  ", "WARN", "ERR ", "CRIT" ),
+         stats.get_word ( "OK  ", "WARN", "ERR ", "CRIT", "UU  ", ),
          str(key), str(stats.value), str(stats.description)
       )
       for key, stats in STATS_DB


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-08-16 13:26 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-08-16 13:26 UTC (permalink / raw
  To: gentoo-commits

commit:     cb8946525e5f55e5959cd1550d22516f6c7a05a7
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 16 13:26:25 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 16 13:26:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=cb894652

files/mako_templates/status: rename None->unknown

---
 files/mako_templates/status.html | 2 +-
 files/mako_templates/status.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/files/mako_templates/status.html b/files/mako_templates/status.html
index 777ea43..7b0d8dd 100644
--- a/files/mako_templates/status.html
+++ b/files/mako_templates/status.html
@@ -36,7 +36,7 @@
    % for key, stats in STATS_DB:
    <TR class="status_${stats.get_word()}">
       <TD>${key}</TD>
-      <TD>${stats.value}</TD>
+      <TD>${stats.value_str}</TD>
       <TD>${stats.description}</TD>
    </TR>
    % endfor

diff --git a/files/mako_templates/status.txt b/files/mako_templates/status.txt
index b6215d9..afc2afc 100644
--- a/files/mako_templates/status.txt
+++ b/files/mako_templates/status.txt
@@ -26,7 +26,7 @@
    line_components = [
       (
          stats.get_word ( "OK  ", "WARN", "ERR ", "CRIT", "UU  ", ),
-         str(key), str(stats.value), str(stats.description)
+         str(key), stats.value_str, stats.description
       )
       for key, stats in STATS_DB
    ]


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/
@ 2013-12-11 18:40 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-12-11 18:40 UTC (permalink / raw
  To: gentoo-commits

commit:     49cf52121c049d9cdf7aa2471f9ceb51e322f19b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Dec 11 17:58:47 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Dec 11 17:58:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=49cf5212

files/mako_templates/status.html: fixup

---
 files/mako_templates/status.html | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/files/mako_templates/status.html b/files/mako_templates/status.html
index 7b0d8dd..cd83503 100644
--- a/files/mako_templates/status.html
+++ b/files/mako_templates/status.html
@@ -4,24 +4,24 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
 <html>
-<style type='text/css'>
-.status_ok {
-   color: #000000;
-}
-.status_warn {
-   color: #e09000;
-}
-.status_err {
-   color: #d00000;
-}
-.status_crit {
-   color: #d00000;
-}
-.status_undef {
-   color: #000080;
-}
-</style>
 <head>
+<style type='text/css'>
+   .status_ok {
+      color: #000000;
+   }
+   .status_warn {
+      color: #e09000;
+   }
+   .status_err {
+      color: #d00000;
+   }
+   .status_crit {
+      color: #d00000;
+   }
+   .status_undef {
+      color: #000080;
+   }
+   </style>
    <title>R overlay status</title>
 </head>
 <body>
@@ -61,7 +61,7 @@
       </UL>
    % endif
 % else:
-   <H3 class="status_crit">no stats available</FONT></H3>
+   <H3 class="status_crit">no stats available</H3>
 % endif
 </body>
 </html>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-11 18:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 12:42 [gentoo-commits] proj/R_overlay:master commit in: files/mako_templates/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2013-12-11 18:40 André Erdmann
2013-08-16 13:26 André Erdmann
2013-08-16 10:43 André Erdmann
2013-08-16 10:43 André Erdmann
2013-08-14 14:56 André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox