Anonymous avatar Anonymous committed 1c1254f

fifteen errors

Comments (0)

Files changed (2)

tw2/core/template.py

             #if the engine name is not specified, find the best possible engine
             engine_name = get_engine_name(template)
             template_path = template
-            
+
 
         if engine_name == 'genshi' and (template_path.startswith('/') or template_path[1] == ':'):
             engine_name = 'genshi_abs'
 
         if engine_name == 'string':
             template = template_path
-            
+
         #xxx: add support for "toscawidgets" template engine
-    
+
         adaptor_renderer = self._get_adaptor_renderer(engine_name, displays_on, template)
 
         if engine_name == 'mako':
         """Return a function that will that processes a template appropriately,
         given the source and destination engine names.
         """
-        if src =='string' or src=='toscawidgets':
+        if src=='value' or src =='string' or src=='toscawidgets':
             return lambda **kw: string.Template(template).substitute(**dict(kw['info']['w'].iteritems()))
+        #what the hell causes this
         if src == dst and src in ('kid', 'genshi'):
             return self[src].transform
         elif src == 'mako' and dst == 'kid':

tw2/core/widgets.py

         #log.debug("Adding call <%s> for %r statically.", call, self)
         self._js_calls.append([str(call), location])
 
-#    @util.class_or_instance
     def display(self, displays_on=None, **kw):
         """Display the widget - render the template. In the template, the
         widget instance is available as the variable ``$w``.
             the parent's template engine, or the default, if there is no
             parent. Set this to ``string`` to get raw string output.
         """
-        if not self:
-            vw = vw_class = core.request_local().get('validated_widget')
-            cls_class = None
-            if vw:
-                # Pull out actual class instances to compare to see if this
-                # is really the widget that was actually validated
-                if not getattr(vw_class, '__bases__', None):
-                    vw_class = vw.__class__
-                if not getattr(cls, '__bases__', None):
-                    cls_class = cls.__class__
-                else:
-                    cls_class = cls
-                if vw_class.__name__ != cls_class.__name__:
-                    vw = None
-                if vw:
-                    return vw.display()
-            return cls.__class__(**kw).display(displays_on)
-        else:
-            if not self.parent:
-                self.prepare()
-            if self._js_calls:
-                #avoids circular reference
-                import resources as rs
-                for item in self._js_calls:
-                    self.resources.append(rs.JSFuncCall(src=str(item[0]), location=item[1]))
-            if self.resources:
-                self.resources = WidgetBunch([r for r in self.resources])
-                for r in self.resources:
-                    r.prepare()
-            mw = core.request_local().get('middleware')
-            if displays_on is None:
-                if self.parent is None:
-                    displays_on = mw and mw.config.default_engine or 'string'
-                else:
-                    displays_on = template.get_engine_name(self.parent.template, mw)
-            v = {'w':self}
-            if mw and mw.config.params_as_vars:
-                for p in self._params:
-                    if hasattr(self, p):
-                        v[p] = getattr(self, p)
-            eng = mw and mw.engines or template.global_engines
-            return eng.render(self.template, displays_on, v)
+        if not self.parent:
+            self.prepare()
+        if self._js_calls:
+            #avoids circular reference
+            import resources as rs
+            for item in self._js_calls:
+                self.resources.append(rs.JSFuncCall(src=str(item[0]), location=item[1]))
+        if self.resources:
+            self.resources = WidgetBunch([r for r in self.resources])
+            for r in self.resources:
+                r.prepare()
+        mw = core.request_local().get('middleware')
+        if displays_on is None:
+            if self.parent is None:
+                displays_on = mw and mw.config.default_engine or 'string'
+            else:
+                displays_on = template.get_engine_name(self.parent.template, mw)
+        v = {'w':self}
+        if mw and mw.config.params_as_vars:
+            for p in self._params:
+                if hasattr(self, p):
+                    v[p] = getattr(self, p)
+        eng = mw and mw.engines or template.global_engines
+        return eng.render(self.template, displays_on, v)
 
     def validate(self, params, state=None):
         """
             for child_param, name in self._child_params:
                 if not hasattr(c, name):
                     setattr(c, name, child_param.default)
+            c.parent = self
 
         super(CompoundWidget, self).post_define()
 
         if not getattr(self, 'id', None) and '_no_autoid' not in self.__dict__:
             self.id = self.__class__.__name__.lower()
             #super(Page, self).post_define()
-            
+
     def request(self, req):
         resp = webob.Response(request=req, content_type="text/html; charset=UTF8")
         self.fetch_data(req)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.