Commits

paj  committed 6279848

Changes suggested by chrisz

  • Participants
  • Parent commits ebf8857

Comments (0)

Files changed (5)

File docs/history.rst

  * The *id* is always the short id; *compound_id* has the full id.
  * The compound ID separator is now a colon (:) and IDs may not contain colons.
  * engine_name is compulsory for templates, and there are no inline templates (yet, may be added later).
- * ToscaWidgets 2 requires Python 2.5. Support for 2.4 and 2.6 is planned.
+ * ToscaWidgets 2 requires Python 2.5, 2.6 or 2.7.
  * tw.api has been removed; just use tw2.core
  * The toscasidgets simple template engine has been removed.
  * Widget.__call__ is no longer an alias for display, as this causes problems for Cheetah.

File docs/standalone.rst

 GrowingGrid
 -----------
 
-The list of cast is somewhat limited; it's not possible to have more than five cast members. We can use a widget from tw2.dynforms to help with this. GrowingGridLayout is a dynamic grid that can grow client-side.
+The list of cast is somewhat limited; there's no easy way to delete a row, any you can't add more than five people at once. We can use a widget from tw2.dynforms to improve this. GrowingGridLayout is a dynamic grid that can grow client-side. Be aware that tw2.dynforms requires your site's visitors to have JavaScript enabled.
 
 To use this, update ``myapp.py``; at the top of the file add::
 

File docs/tutorial.rst

 Installation
 ------------
 
-First of all, you need Python. Version 2.5 is recommended, while any version 2.4 - 2.7 is intended to work. The recommended way to install ToscaWidgets is using `pip <http://pip.openplans.org/>`_. Once you have pip itself installed, you should issue (with sudo if required)::
+First of all, you need Python - version 2.5, 2.6 or 2.7. The recommended way to install ToscaWidgets is using `pip <http://pip.openplans.org/>`_. Once you have pip itself installed, you should issue (with sudo if required)::
 
     pip install tw2.dynforms tw2.devtools tw2.sqla genshi elixir
     

File tw2/core/resources.py

     A link to a file.
     '''
     id = None
-    link = pm.Param('Direct web link to file. If this is not specified, it is automatically generated, based on :attr:`modname` and :attr:`filename`.')
+    link = pm.Param('Direct web link to file. If this is not specified, it is automatically generated, based on `modname` and `filename`.')
     modname = pm.Param('Name of Python module that contains the file.', default=None)
     filename = pm.Param('Path to file, relative to module base.', default=None)
 
     the current request.
 
     Usually widgets register them when they're displayed and they have instances of
-    :class:`tw.api.Resource` declared at their :attr:`tw.api.Widget.javascript` or
-    :attr:`tw.api.Widget.css` attributes.
+    :class:`tw.api.Resource` declared at their `tw.api.Widget.javascript` or
+    `tw.api.Widget.css` attributes.
 
     Resources can also be registered manually from a controller or template by
     calling their :meth:`tw.api.Resource.inject` method.

File tw2/core/widgets.py

 
     error_msg = pm.Variable("Validation error message.")
     parent = pm.Variable("The parent of this widget, or None if this is a root widget.")
-    Controller = pm.Variable("Default controller for this widget", default=None)
-    _check_authz = pm.Variable("Method for checking authorization, should be classmethod in form: def _check_authn(cls, req, method)", default=None)
-    _check_authn = pm.Variable("Method for checking authentication, should be classmethod in the form: def _check_authn(cls, req)", default=None)
 
     _sub_compound = False
     _valid_id_re = re.compile(r'^[a-zA-Z][\w\-\_\.]*$')
             cls.attrs = cls.attrs.copy()
             cls.attrs['id'] = cls.compound_id
 
-        cls.attrs['controller']   = getattr(cls, 'Controller')
-        cls.attrs['_check_authn'] = getattr(cls, '_check_authn')
-        cls.attrs['_check_authz'] = getattr(cls, '_check_authz')
-
         if getattr(cls, 'id', None):
             import middleware
             capp = getattr(cls.__module__, 'tw2_controllers', middleware.global_controllers)
     def children_deep(cls):
         yield cls
 
-    if 0:
-        @classmethod
-        def request(cls, req):
-            """
-            Override this method to define your own way of handling a widget request.
-    
-            The default does TG-style object dispatch.
-            """
-    
-            authn = cls.attrs.get('_check_authn')
-            authz = cls.attrs.get('_check_authz')
-    
-            if authn and not authn(req):
-                return util.abort(req, 401)
-    
-            controller = cls.attrs.get('controller', cls.Controller)
-            if controller is None:
-                return util.abort(req, 404)
-    
-            path = req.path_info.split('/')[3:]
-            if len(path) == 0:
-                method_name = 'index'
-            else:
-                method_name = path[0]
-            # later we want to better handle .ext conditions, but hey
-            # this aint TG
-            if method_name.endswith('.json'):
-                method_name = method_name[:-5]
-            method = getattr(controller, method_name, None)
-            if method:
-                if authz and not authz(req, method):
-                    return util.abort(req, 403)
-    
-                controller = cls.Controller()
-                return method(controller, req)
-            return util.abort(req, 404)
-
 
 class LeafWidget(Widget):
     """
             Widget.post_define.im_func(cls)
             cls.child = cls.child(parent=cls)
         else:
-            cls.child = cls.child(id=cls_id, Controller=cls.Controller, _check_authz=cls._check_authz, _check_authn=cls._check_authn, parent=cls)
+            cls.child = cls.child(id=cls_id, parent=cls)
 
     @classmethod
     def _gen_compound_id(cls, for_url):