[Checkins] SVN: grok/branches/timte-json/src/grok/ added comments
Tim TerlegÃÂ¥rd
tim.terlegard at lovelysystems.com
Mon Mar 19 17:02:20 EDT 2007
Log message for revision 73359:
added comments
Changed:
U grok/branches/timte-json/src/grok/components.py
U grok/branches/timte-json/src/grok/meta.py
-=-
Modified: grok/branches/timte-json/src/grok/components.py
===================================================================
--- grok/branches/timte-json/src/grok/components.py 2007-03-19 20:54:58 UTC (rev 73358)
+++ grok/branches/timte-json/src/grok/components.py 2007-03-19 21:02:20 UTC (rev 73359)
@@ -222,7 +222,8 @@
pass
class JSON(BrowserPage):
- def __call__(self, *args):
+
+ def __call__(self):
view_name = self.__view_name__
method = getattr(self, view_name)
method_result = mapply(method, (), self.request)
Modified: grok/branches/timte-json/src/grok/meta.py
===================================================================
--- grok/branches/timte-json/src/grok/meta.py 2007-03-19 20:54:58 UTC (rev 73358)
+++ grok/branches/timte-json/src/grok/meta.py 2007-03-19 21:02:20 UTC (rev 73359)
@@ -216,11 +216,9 @@
def register(self, context, name, factory, module_info, templates):
view_context = util.determine_class_context(factory, context)
- # XXX We should really not make __FOO__ methods available to
- # the outside -- need to discuss how to restrict such things.
methods = util.methods_from_class(factory)
- # Determine the default permission for the XMLRPC methods.
+ # Determine the default permission for the JSON methods.
# There can only be 0 or 1 of those.
permissions = util.class_annotation(factory, 'grok.require', [])
if not permissions:
@@ -233,6 +231,8 @@
% factory, factory)
for method in methods:
+ # Create a new class with a __view_name__ attribute so the
+ # JSON class knows what method to call.
method_view = type(
factory.__name__, (factory,),
{'__view_name__': method.__name__}
More information about the Checkins
mailing list