[Mpuls-commits] r2825 - in base/trunk: . mpulsweb/config mpulsweb/lib mpulsweb/templates/administration/dialogs

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 31 12:04:02 CEST 2010


Author: torsten
Date: 2010-05-31 12:03:49 +0200 (Mon, 31 May 2010)
New Revision: 2825

Removed:
   base/trunk/mpulsweb/templates/administration/dialogs/failed_new_user.mako
Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/config/environment.py
   base/trunk/mpulsweb/config/importer.py
   base/trunk/mpulsweb/config/middleware.py
   base/trunk/mpulsweb/lib/base.py
   base/trunk/mpulsweb/lib/renderer.py
Log:
Merged



Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/ChangeLog	2010-05-31 10:03:49 UTC (rev 2825)
@@ -1,3 +1,83 @@
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (tag): Allow attribute names that
+	contain minus signs by converting underscored to minus signs in
+	attribute names.  Fortunately there are no attribute names in HTML
+	that use underscores.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/config/environment.py (load_environment): Add an
+	explicit configuration option for the template module directory:
+	mpuls.app.path.template_cache.  If that option is not given use
+	the previously used directory as fallback.  The previously used
+	directory is simply derived from cache_dir and is this directly
+	tied to the beaker session directory.  This is a problem if two
+	applications have to share their session data but not their
+	templates.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/config/environment.py (load_environment): Lookup
+	settings in both app_conf and global_conf, instead of only in
+	global_conf.  This allows the settings to be in the application's
+	section in the configuration file, not only in the DEFAULT
+	section.  This is necessary when running two MPuls applications in
+	the same server.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/base.py (BaseController.__before__): redirect_to
+	will also call url_for so it's actually wrong to pass the return
+	value of url_for to redirect_to because it will be processed
+	twice.  The result is not always incorrect, but if e.g. the
+	application is not mounted directly at "/" in the server so that
+	SCRIPT_NAME is not empty, SCRIPT_NAME will be added twice to the
+	url.  Fix this by omitting the url_for call.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/config/importer.py (import_overridable_module): Only
+	append mpuls.app.root to sys.path if it's not already in the path.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/config/middleware.py (SimpleExceptionLogger): New class
+	for very simple an more robust exception logging.
+	(make_app): Install SimpleExceptionLogger if the config option
+	mpuls.app.simple-exception-handler is true. The more sophisticated
+	pylons error handlers sometimes have problems with exceptions that
+	contain non-ascii characters in which case exceptions raised from
+	withing the error handler completely mask the original exception.
+
+2010-05-21  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/templates/administration/dialogs/failed_new_user.mako:
+	Removed.  Not used anymore.
+
+2010-05-20  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (tag): Minor documentation fixes.
+
+2010-05-20  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (ViewRenderer._renderRepeatList)
+	(ViewRenderer._renderMatrix, ErrorRenderer.render_items): Use the
+	tag function in more places when rendering HTML tags.
+
+2010-05-20  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (RepeatGroupRenderer.render_digest)
+	(RepeatGroupRenderer.render): Rework these methods a little to
+	avoid some problems that could occur if the rg_digests haven't
+	been set properly.  In particular the default values used for
+	missing items were lists where dictionaries were expected by the
+	code.
+
+2010-05-19  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py: fix formatting.
+
 2010-05-17  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* mpulsweb/lib/config.py: Disabled tagging on default (Work in

Modified: base/trunk/mpulsweb/config/environment.py
===================================================================
--- base/trunk/mpulsweb/config/environment.py	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/config/environment.py	2010-05-31 10:03:49 UTC (rev 2825)
@@ -42,12 +42,20 @@
 
 def load_environment(global_conf, app_conf):
     """Configure the Pylons environment via the ``pylons.config`` object"""
+    def get(item):
+        """Lookup item in app_conf and global_conf.  Return the first one found.
+        If item is found in neither, None is returned.
+        """
+        if item in app_conf:
+            return app_conf[item]
+        return global_conf.get(item)
+
     # Pylons paths
     root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
     # Templates
     template_urls = []
-    custom_templates = global_conf.get('mpuls.app.path.templates')
+    custom_templates = get('mpuls.app.path.templates')
     if custom_templates:
         log.info('Custom "template" directory: %s' % custom_templates)
         template_urls.append(custom_templates)
@@ -55,16 +63,16 @@
 
     # Static content (images, styles, formed...)
     static_urls = []
-    custom_static = global_conf.get('mpuls.app.path.public')
+    custom_static = get('mpuls.app.path.public')
     if custom_static:
         log.info('Custom "public" directory: %s' % custom_static)
-        static_urls.append(global_conf.get('mpuls.app.path.public'))
+        static_urls.append(get('mpuls.app.path.public'))
     static_urls.append(os.path.join(root, 'public'))
 
     # Controllers
     controller_url = os.path.join(root, 'controllers')
-    if global_conf.get('mpuls.app.path.controllers'):
-        controller_url = global_conf.get('mpuls.app.path.controllers')
+    if get('mpuls.app.path.controllers'):
+        controller_url = get('mpuls.app.path.controllers')
         log.info('Custom "controller" directory: %s' % controller_url)
 
     paths = dict(root=root,
@@ -81,11 +89,13 @@
     config['pylons.h'] = mpulsweb.lib.helpers
 
     # Create the Mako TemplateLookup, with the default auto-escaping
+    module_directory = config.get('mpuls.app.path.template_cache',
+                                  os.path.join(app_conf['cache_dir'],
+                                               'templates'))
     config['pylons.g'].mako_lookup = \
         TemplateLookup(directories=paths['templates'],
                        error_handler=handle_mako_error,
-                       module_directory=os.path.join(app_conf['cache_dir'],
-                                                     'templates'),
+                       module_directory=module_directory,
                        input_encoding='utf-8', default_filters=['escape'],
                        imports=['from webhelpers.html import escape'])
 

Modified: base/trunk/mpulsweb/config/importer.py
===================================================================
--- base/trunk/mpulsweb/config/importer.py	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/config/importer.py	2010-05-31 10:03:49 UTC (rev 2825)
@@ -27,7 +27,8 @@
 
     # Append root dir of the application configuration to the pythonpath
     app_root = config.get('mpuls.app.root')
-    sys.path.append(app_root)
+    if app_root not in sys.path:
+        sys.path.append(app_root)
 
     instance_module = config.get('mpuls.app.instance') + "." + modulename
     module = try_import_module(instance_module)

Modified: base/trunk/mpulsweb/config/middleware.py
===================================================================
--- base/trunk/mpulsweb/config/middleware.py	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/config/middleware.py	2010-05-31 10:03:49 UTC (rev 2825)
@@ -21,6 +21,29 @@
 log = logging.getLogger(__name__)
 
 
+class SimpleExceptionLogger(object):
+
+    """Simply log any exception raised while a request is handled.
+
+    If an exception is raised during a request, the exception is logged
+    with log.exception and reraised without any further processing.
+    This can be used to make sure that the actual exception information
+    is logged even if the more sophisticated error handlers of
+    e.g. Pylons fail.  For that use-case it has to be as near to the
+    actual application in the application stack as possible.
+    """
+
+    def __init__(self, application):
+        self.application = application
+
+    def __call__(self, *args, **kw):
+        try:
+            return self.application(*args, **kw)
+        except:
+            log.exception("Exception while handling request")
+            raise
+
+
 class MyPylonsApp(PylonsApp):
 
     def find_controller(self, controller):
@@ -84,6 +107,18 @@
     # The Pylons WSGI app
     app = MyPylonsApp()
 
+    # Pylon's exception handler (at least the debug handler) sometimes
+    # has problems with exceptions whose messages are byte-strings
+    # containing non-ascii characters, which can happen when
+    # e.g. psycopg2 is used in a German locale.  To avoid loss of
+    # information, we put the SimpleExceptionLogger immediately around
+    # the pylons app.
+    if config.get("mpuls.app.simple-exception-handler", False):
+        log.debug("Using MPuls SimpleExceptionLogger")
+        app = SimpleExceptionLogger(app)
+    else:
+        log.debug("Not using MPuls SimpleExceptionLogger")
+
     # Routing/Session/Cache Middleware
     app = RoutesMiddleware(app, config['routes.map'])
     app = SessionMiddleware(app, config)

Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/lib/base.py	2010-05-31 10:03:49 UTC (rev 2825)
@@ -179,7 +179,7 @@
         except KeyError:
             p = str(request.path_info)
             if not p in ('/auth/login', '/auth/loginAction'):
-                redirect_to(h.url_for(controller='/auth', action='login'))
+                redirect_to(controller='/auth', action='login')
 
     def __call__(self, environ, start_response):
         """Invoke the Controller"""

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-05-31 10:03:49 UTC (rev 2825)
@@ -83,21 +83,29 @@
     The values of string attributes are converted to strings if they are
     not aleady strings (byte-strings or unicode) using these rules: None
     is converted to the empty string, other values are converted using
-    the str function.  After value of string attributes will be properly
-    escaped as attribute values when inserted into the tag.
+    the str function.  After conversion the values of string attributes
+    will be properly escaped as attribute values when inserted into the
+    tag.
 
     Boolean flags are treated differently: if the value of such an
     attribute is true, the attribute is included in the tag without a
     value, if the value is false, the attribute is omitted.  The boolean
     attributes handled in this way are given by the _booleans parameter,
     which is a sequence of attribute names.  Its default value is
-    ('checked', 'disabled', 'selected')
+    ('checked', 'disabled', 'multiple', 'selected')
 
     To allow for attribute names that are also python keywords, a single
     trailing underscore character is removed from an attribute name if
     it is preset, so that e.g. the class attribute can be specified
     using the class_ keyword parameters.
 
+    A few attribute names are not valid Python identifiers because they
+    contain a minus-sign (e.g. accept-charset).  However, since there
+    are no attribute names that contain underscores, underscores in a
+    keyword argument will be converted to minus-signs to determine the
+    attribute name.  For instance the accept-charset attribute can be
+    given as accept_charset to this function.
+
     Examples:
     >>> from mpulsweb.lib.renderer import tag
     >>> tag("input", type="text", name="title", disabled=False)
@@ -108,6 +116,7 @@
     for name, value in attrs.items():
         if name.endswith("_"):
             name = name[:-1]
+        name = name.replace("_", "-")
         if name in _booleans:
             if value:
                 out.append(' %s="%s"' % (name, name))
@@ -235,19 +244,15 @@
                        ' accept-charset="UTF-8" method="POST">\n')
             # Add submitbutton at the top of the page too
             out.append('<div class="widget formbuttons">')
-            out.append(tag("input",type="submit",
-                        name="save",
-                        class_="submit_button",
-                        value=_('Save'),
-                        tabindex=self.next_tabindex()))
+            out.append(tag("input", type="submit", name="save",
+                           class_="submit_button", value=_('Save'),
+                           tabindex=self.next_tabindex()))
             if showNext:
                 out.append("&nbsp;")
-                out.append(tag("input",
-                            type="submit",
-                            name="savenext",
-                            class_="submit_button",
-                            value=_('Save and proceed'),
-                            tabindex=self.next_tabindex()))
+                out.append(tag("input", type="submit", name="savenext",
+                               class_="submit_button",
+                               value=_('Save and proceed'),
+                               tabindex=self.next_tabindex()))
             out.append('</div>')
         out.append('<div>')
         #out.append('<div class="widget formfields">')
@@ -263,20 +268,15 @@
         out.append('</div>')
         if not self.ro_mode:
             out.append('<div class="widget formbuttons">')
-            out.append(tag("input",
-                        type="submit",
-                        class_="submit_button",
-                        name="save",
-                        value=_('Save'),
+            out.append(tag("input", type="submit", class_="submit_button",
+                           name="save", value=_('Save'),
                            tabindex=self.next_tabindex()))
             if showNext:
                 out.append("&nbsp;")
-                out.append(tag("input",
-                            type="submit",
-                            name="savenext",
-                            class_="submit_button",
-                            value=_('Save and proceed'),
-                            tabindex=self.next_tabindex()))
+                out.append(tag("input", type="submit", name="savenext",
+                               class_="submit_button",
+                               value=_('Save and proceed'),
+                               tabindex=self.next_tabindex()))
             out.append('</div>')
             out.append('</form>\n')
 
@@ -308,7 +308,7 @@
         meta = self._getMeta(node)
         out = []
         warning = node.getIdentifier() in self.warnings and "warning" or ""
-        error   = node.hasErrors() and "error" or ""
+        error = node.hasErrors() and "error" or ""
         if labeltag:
             out.append(tag("label", for_=node.getIdentifier()))
             out.append(tag("a", class_=error or warning,
@@ -335,8 +335,8 @@
                            href="/annotations/required/%s" % meta.getName(),
                            target="_blank"))
             out.append('<img src="/images/icons/formular/required.png"'
-                        ' width="12"'
-                        ' height="12"'
+                       ' width="12"'
+                       ' height="12"'
                        ' alt="required">')
             out.append('</a>')
         if is_evaluation_relevant(meta.getFlags()):
@@ -361,11 +361,10 @@
             spanClass = 'error'
 
         out.append('<span class="%s">' % spanClass)
-        out.append(tag("form:%s" % spanClass,
-                name      = node.getIdentifier(),
-                format    = ''))
+        out.append(tag("form:%s" % spanClass, name=node.getIdentifier(),
+                       format=''))
         out.append('</span>')
-        
+
         return "".join(out)
 
     def _checkWarnings(self, node):
@@ -442,14 +441,10 @@
             out.append('</td>')
             out.append('<td class="vcontrol" width="15">')
             if not self.ro_mode:
-                out.append('''<input name="del_rg" 
-                            type="image" 
-                            src="/images/icons/delete_active_16.png" 
-                            value="%s"
-                            alt="%s"
-                            title="%s">''' % (child.getIdentifier(),
-                                              _('Delete RG'),
-                                              _('Delete RG')))
+                out.append(tag("input", name="del_rg", type="image",
+                               src="/images/icons/delete_active_16.png",
+                               value=child.getIdentifier(),
+                               alt=_('Delete RG'), title=_('Delete RG')))
             out.append('</td>')
             out.append('</tr>')
         if self.ro_mode:
@@ -459,14 +454,10 @@
             out.append('<tr>')
             out.append('<td class="hcontrol" style="text-align: right;"'
                        ' colspan="2">')
-            out.append('''<input width="16" 
-                        name="add_rg" 
-                        type="image" src="/images/icons/new_16.png" 
-                        value="%s"
-                        alt="%s"
-                        title="%s">''' % (node.getIdentifier(),
-                                          _('Add new RG'),
-                                          _('Add new RG')))
+            out.append(tag("input", width="16", name="add_rg",
+                           type="image", src="/images/icons/new_16.png",
+                           value=node.getIdentifier(),
+                           alt=_('Add new RG'), title=_('Add new RG')))
             out.append("</td>")
             out.append("</tr>")
         return out
@@ -554,8 +545,8 @@
 
     def _renderText(self, node):
         meta = self._getMeta(node)
-        out  = []
-        id   = node.getIdentifier()
+        out = []
+        id = node.getIdentifier()
         out.append(self._renderLabel(node))
         out.append(self._renderAttributes(node))
         out.append('<br>')
@@ -649,22 +640,17 @@
         self.toTarget(Item("".join(out)), meta.getTarget())
 
     def _renderPlainBool(self, node):
-        meta   = self._getMeta(node)
-        id     = node.getIdentifier()
+        meta = self._getMeta(node)
+        id = node.getIdentifier()
         mvalue = meta.getValue()
-        value  = node.getValue()
+        value = node.getValue()
         #checked = self.stateStack[-1] == value and "checked" or ""
         #print "mvalue: %s value: %s" % (mvalue, value)
         out = []
-        out.append(tag("input",
-                        type   = "checkbox",
-                        class_ = "checkbox",
-                        id     = id,
-                        name   = id,
-                        value  = "1",
-                        disabled = self.ro_mode,
-                        checked  = (value == 1),
-                        tabindex = self.next_tabindex(),
+        out.append(tag("input", type="checkbox", class_="checkbox",
+                       id=id, name=id, value="1", disabled=self.ro_mode,
+                       checked=(value == 1),
+                       tabindex=self.next_tabindex(),
                        **SET_MODIFICATION_ATTRS))
         out.append(hidden_bool_tag(id))
         out.append(self._renderLabel(node))
@@ -719,7 +705,7 @@
         except:
             toSelect = None
         selected = toSelect == (value or value==0) and "selected" or ""
-        
+
         if selected:
             selected = selected + '="' + selected + '"'
 
@@ -750,15 +736,15 @@
 
         # write table header
         nr_of_children = len(self._getMeta(node.getChildren()[0]).children) + 1
-        
+
         out.append('<thead>')
         out.append('<tr>')
-        out.append('<th class="label" colspan="%s">' % nr_of_children)
+        out.append(tag("th", class_="label", colspan=nr_of_children))
         out.append(self._renderLabel(node, False))
         out.append(self._renderAttributes(node))
         out.append('</th>')
         out.append('</tr>')
-        
+
         out.append('<tr>')
         out.append('<th></th>')
         for hcol in self._getMeta(node.getChildren()[0]).children:
@@ -779,14 +765,15 @@
         out.append('<tbody>')
         for num, row in enumerate(node.getChildren()):
             out.append('<tr>')
-            out.append('<td class="label %s">' % (num%2 and "hl" or ""))
+            out.append(tag("td", class_=("label %s"
+                                         % (num % 2 and "hl" or ""))))
             out.append(self._renderLabel(row, False))
             out.extend(self._renderAttributes(row))
             out.append('</td>')
             self.stateStack.append(str(row.getValue()))
             for col in self._getMeta(row).children:
                 value = col.getValue()
-                out.append('<td class="%s">' % (num%2 and "hl" or ""))
+                out.append(tag("td", class_=(num%2 and "hl" or "")))
                 out.append(tag("input", type="radio", name=row.getIdentifier(),
                                value=value, disabled=self.ro_mode,
                                checked=(value == self.stateStack[-1]),
@@ -798,15 +785,17 @@
 
         # write legend
         length = len(self._getMeta(node.getChildren()[0]).children)+1
-        out.append('<tr><td colspan="%s"></td></tr>' % str(length))
+        out.append('<tr>')
+        out.append(tag("td", colspan=length))
+        out.append('</td></tr>')
         if legend:
             out.append('<tr>')
-            out.append('<td class="legend" colspan="%s">' % str(length))
+            out.append(tag("td", class_="legend", colspan=length))
             out.append(" ".join(legend))
             out.append('</td>')
             out.append('</tr>')
         out.append('<tr>')
-        out.append('<td class="label" colspan="%s">' % str(length))
+        out.append(tag("td", class_="label", colspan=length))
         out.append(self._renderErrors(node))
         out.append('</td>')
         out.append('</tr>')
@@ -839,18 +828,17 @@
 
     def _renderExternalChoiceList(self, choiceList):
         out = []
-        
+
         # Sort the list according to the target
         children = sorted(choiceList.getChildren(),
-                        key     = lambda child: child.getTarget(),
-                        reverse = True)
-        
+                          key=lambda child: child.getTarget(),
+                          reverse=True)
+
         if children:
             for child in children:
                 value = child.getValue()
-                out.append(tag("option",
-                               value    = value,
-                               selected = (value == self.stateStack[-1])))
+                out.append(tag("option", value=value,
+                               selected=(value == self.stateStack[-1])))
                 out.append(escape(child.getDescription()))
                 out.append("</option>")
         self.toTarget(Text("\n".join(out)),
@@ -931,13 +919,10 @@
             digests = {}
         self.rg_digests = digests
 
-    def render_digest(self, rg):
+    def render_digest(self, rg, fields):
         out = []
         case_id = rg.getIdentifier().split(':')[-1]
 
-        fields = self.rg_digests.get(self._getMeta(rg).getName(), []).get('fields')
-        log.debug(fields)
-
         out.append('<table class="rgdigest">')
         if not fields:
             log.warning("No digest specification for repeat group %r",
@@ -973,7 +958,7 @@
                     for child in childs:
                         if str(child.getValue()) == str(value):
                             value = child.getDescription()
-                            break;
+                            break
                 out.append('%s' % NA(value))
                 out.append('</a>')
                 out.append('</td>')
@@ -982,7 +967,6 @@
         return "".join(out)
 
     def render(self, showNext=False):
-
         out = []
         out.append('<div class="widget">')
         out.append('<table class="list">')
@@ -991,40 +975,53 @@
                       escape(_('Actions'))))
         items = self.page.getChildren()
 
-        # Sorting of RG. 
+        # Sorting of RG.
         class SortDummy:
-            def __init__(self, rg, it, case_id, field):
+            def __init__(self, rg, it, case_id, sort_field, fields):
                 self.rg = rg
-                self.value = str(it.getItem('%s:%s:%s' % (field, rg.getInternalIdentifier(), case_id)).getValue())
+                self.value = str(it.getItem('%s:%s:%s'
+                                            % (sort_field,
+                                               rg.getInternalIdentifier(),
+                                               case_id)).getValue())
+                self.fields = fields
+                print "RepeatGroupRenderer.render.SortDummy.__init__", fields
+                print "RepeatGroupRenderer.render.SortDummy.__init__", str(self.value)
 
         unsorted_items = []
-        reverse_order = False 
+        reverse_order = False
         if len(items) > 0:
             rg = items[0]
             case_id = rg.getIdentifier().split(':')[-1]
-            fields = self.rg_digests.get(self._getMeta(rg).getName(), []).get('fields')
-            sort_field = self.rg_digests.get(self._getMeta(rg).getName(), []).get('sort_field', fields[0])
-            sort_order = self.rg_digests.get(self._getMeta(rg).getName(), []).get('sort_order')
-            for rg in items:
-                unsorted_items.append(SortDummy(rg, self.it, case_id, sort_field))
-            if sort_order == "desc":
-                reverse_order = True
-        sorted_items = sorted(unsorted_items, key=lambda rg: rg.value, reverse=reverse_order)
+            digest_spec = self.rg_digests.get(self._getMeta(rg).getName())
+            if digest_spec is None:
+                log.error("No digest specification for %r", rg)
+            else:
+                fields = digest_spec.get('fields')
+                sort_field = digest_spec.get('sort_field', fields[0])
+                sort_order = digest_spec.get('sort_order')
+                for rg in items:
+                    unsorted_items.append(SortDummy(rg, self.it, case_id,
+                                                    sort_field, fields))
+                if sort_order == "desc":
+                    reverse_order = True
+        sorted_items = sorted(unsorted_items, key=lambda rg: rg.value,
+                              reverse=reverse_order)
 
-        for num, rg in enumerate([sd.rg for sd in sorted_items]):
+        for sd in sorted_items:
             out.append('<tr>')
             out.append('<td>')
-            out.append(self.render_digest(rg))
+            out.append(self.render_digest(sd.rg, sd.fields))
             out.append('</td>')
             out.append('<td class="actions">')
-            out.append(tag("a", href=("/navigation/select_branch/%s"
-                                      % rg.getChildren()[0].getIdentifier())))
-            out.append(tag("img", src="/images/icons/open_active_22.png", border="0",
-                           alt=_('view'), title=_('view')))
+            out.append(tag("a",
+                           href=("/navigation/select_branch/%s"
+                                 % sd.rg.getChildren()[0].getIdentifier())))
+            out.append(tag("img", src="/images/icons/open_active_22.png",
+                           border="0", alt=_('view'), title=_('view')))
             out.append("</a>")
             if not self.ro_mode:
                 out.append(tag("a", href=("/repeatgroup/delete/%s"
-                                          % rg.getIdentifier())))
+                                          % sd.rg.getIdentifier())))
                 out.append(tag("img", src="/images/icons/delete_active_22.png",
                                border="0", alt=_('delete'), title=_('delete')))
                 out.append("</a>")
@@ -1057,22 +1054,22 @@
 
         out = []
         out.append(self.render_items(self.error_items,
-                                    _('Formular errors'),
-                                    "/images/icons/info/alert.png",
-                                    tree))
+                                     _('Formular errors'),
+                                     "/images/icons/info/alert.png",
+                                     tree))
         out.append(self.render_items(self.warnings,
-                                    _('Formular warnings'),
-                                    "/images/icons/info/info.png",
-                                    tree,
-                                    css_class = 'warning-box'))
+                                     _('Formular warnings'),
+                                     "/images/icons/info/info.png",
+                                     tree,
+                                     css_class = 'warning-box'))
         return "".join(out)
 
-    def render_items(self, items, title, icon, tree, css_class = ""):
+    def render_items(self, items, title, icon, tree, css_class=""):
         if not items:
             return ""
 
         out = []
-        out.append('<div class="widget dialog %s">' % css_class)
+        out.append(tag("div", class_=("widget dialog %s" % css_class)))
         out.append('<h1>')
         out.append(tag("img", src=icon, alt=''))
         out.append(escape(title))
@@ -1089,12 +1086,10 @@
             for v in values:
                 out.append('<li>')
                 out.append(tag("a", href="/formularpage/undo/%s" % k))
-                out.append(tag("img",
-                               src    = "/images/icons/formular/undo.png",
-                               border = "0",
-                               alt    = "undo",
-                               title  = _('Restore last valid value'),
-                               _close = True))
+                out.append(tag("img", src="/images/icons/formular/undo.png",
+                               border="0", alt="undo",
+                               title=_('Restore last valid value'),
+                               _close=True))
                 out.append('</a>')
                 out.append(tag("a", class_="error", href="#f_%s" % k))
                 out.append("%s:</a>" % escape(description))

Deleted: base/trunk/mpulsweb/templates/administration/dialogs/failed_new_user.mako
===================================================================
--- base/trunk/mpulsweb/templates/administration/dialogs/failed_new_user.mako	2010-05-31 10:03:32 UTC (rev 2824)
+++ base/trunk/mpulsweb/templates/administration/dialogs/failed_new_user.mako	2010-05-31 10:03:49 UTC (rev 2825)
@@ -1,9 +0,0 @@
-## -*- coding: utf-8 -*- 
-<%inherit file="../../main.mako" />
-<%def name="buildNavipath()">
-	${parent.buildNavipath()}
-	<li><a href="/case/">${_('adm_np_root')}</a></li>
-        <li><a href="/administration/overviewUser">${_('adm_np_overview')}</a></li>
-	<li><a href="#">${_('adm_np_failed_createuser')}</a></li>
-</%def>
-<%include file="../../dialogs/failed.mako" />



More information about the Mpuls-commits mailing list