[Checkins] SVN: z3c.jsonrpc/branches/adamg-ztk/s woot? suddenly it checks permission

Adam Groszer agroszer at gmail.com
Tue Jan 26 06:57:58 EST 2010


Log message for revision 108506:
  woot? suddenly it checks permission

Changed:
  U   z3c.jsonrpc/branches/adamg-ztk/setup.py
  U   z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/README.txt
  U   z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/configure.zcml
  U   z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/ftesting.zcml
  U   z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/publisher.py
  U   z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/testing.py

-=-
Modified: z3c.jsonrpc/branches/adamg-ztk/setup.py
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/setup.py	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/setup.py	2010-01-26 11:57:58 UTC (rev 108506)
@@ -73,6 +73,7 @@
         'zope.app.twisted',
         'zope.component',
         'zope.configuration',
+        'zope.container',
         'zope.i18n',
         'zope.i18nmessageid',
         'zope.interface',

Modified: z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/README.txt
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/README.txt	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/README.txt	2010-01-26 11:57:58 UTC (rev 108506)
@@ -115,11 +115,11 @@
 Let's define a content object that is a container:
 
   >>> import zope.interface
-  >>> class IDemoContainer(zope.app.container.interfaces.IReadContainer):
+  >>> class IDemoContainer(zope.container.interfaces.IReadContainer):
   ...     """Demo container interface."""
 
   >>> import persistent
-  >>> from zope.app.container import btree
+  >>> from zope.container import btree
 
   >>> class DemoContainer(btree.BTreeContainer):
   ...     """Demo container."""
@@ -188,7 +188,8 @@
 (The container class needs permission configuration too)
 
   >>> context = xmlconfig.file('meta.zcml', z3c.jsonrpc)
-  >>> context = xmlconfig.file('meta.zcml', zope.app.component, context)
+  >>> context = xmlconfig.file('meta.zcml', zope.component, context)
+  >>> context = xmlconfig.file('meta.zcml', zope.security, context)
   >>> context = xmlconfig.string("""
   ... <configure
   ...     xmlns:z3c="http://namespaces.zope.org/z3c"
@@ -429,7 +430,7 @@
 
 also setup the site hook:
 
-  >>> from zope.app.component import hooks
+  >>> from zope.component import hooks
   >>> hooks.setSite(site)
 
 and just call a method this will now raise a ResponseError:

Modified: z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/configure.zcml
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/configure.zcml	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/configure.zcml	2010-01-26 11:57:58 UTC (rev 108506)
@@ -26,18 +26,18 @@
       />
 
   <view
-      for="zope.app.container.interfaces.IItemContainer"
+      for="zope.container.interfaces.IItemContainer"
       type=".interfaces.IJSONRPCRequest"
       provides=".interfaces.IJSONRPCPublisher"
-      factory="zope.app.container.traversal.ItemTraverser"
+      factory="zope.container.traversal.ItemTraverser"
       permission="zope.Public"
       />
 
   <view
-      for="zope.app.container.interfaces.IReadContainer"
+      for="zope.container.interfaces.IReadContainer"
       type=".interfaces.IJSONRPCRequest"
       provides=".interfaces.IJSONRPCPublisher"
-      factory="zope.app.container.traversal.ContainerTraverser"
+      factory="zope.container.traversal.ContainerTraverser"
       permission="zope.Public"
       />
 
@@ -52,8 +52,8 @@
   <!-- If you register your own layer and skin setup, be careful and register
        the skin namespace below for our JSON-RPC layer. This will prevents
        that you will get the wrong skin namespace based on the __iro__ order of
-       the layer interfaces. 
-       
+       the layer interfaces.
+
        Since JSON-RPC supports layers and skins it's highly recommended not to
        mix IJSONRPCLayer and IBrowserRequest layers. Otherwise you have to make
        sure that the right default skin interface get applied.

Modified: z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/ftesting.zcml
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/ftesting.zcml	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/ftesting.zcml	2010-01-26 11:57:58 UTC (rev 108506)
@@ -6,7 +6,7 @@
     i18n_domain="zope">
 
   <include package="zope.i18n" file="meta.zcml" />
-  <include package="zope.app.component" file="meta.zcml" />
+  <include package="zope.component" file="meta.zcml" />
   <include package="zope.app.publication" file="meta.zcml" />
   <include package="zope.app.publisher" file="meta.zcml" />
   <include package="zope.app.security" file="meta.zcml" />
@@ -19,8 +19,7 @@
   <include package="zope.publisher" />
   <include package="zope.traversing" />
   <include package="zope.app.appsetup" />
-  <include package="zope.app.component" />
-  <include package="zope.app.container" />
+  <include package="zope.container" />
   <include package="zope.app.publication" />
   <include package="zope.app.publisher" />
   <include package="zope.app.security" />

Modified: z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/publisher.py
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/publisher.py	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/publisher.py	2010-01-26 11:57:58 UTC (rev 108506)
@@ -78,26 +78,26 @@
 
 class JSONRPCRequest(HTTPRequest):
     """JSON-RPC request implementation based on IHTTPRequest.
-    
+
     This implementation supports the following JSON-RPC Specification versions:
-    
+
     - 1.0
     - 1.1
     - 2.0
-    
+
     Version 1.0 and 1.1 offers params as a list. This params get converted to
     positional arguments if calling the JSON-RPC function.
-    
-    The version 2.0 offers support for named key/value params. The important 
-    thing to know is that this implementation will convert named params kwargs 
-    to form paramters. This means the method doesn't get any key word argument. 
-    The reason why I was choosing is the existing publisher implementation and 
-    it's debugger integration. If someone likes to integrate **kwargs support, 
-    take a look at the publisher.publish method and it's mapply function which 
-    get wrapped by the Debugger class. I hope that's fine for now and I 
+
+    The version 2.0 offers support for named key/value params. The important
+    thing to know is that this implementation will convert named params kwargs
+    to form paramters. This means the method doesn't get any key word argument.
+    The reason why I was choosing is the existing publisher implementation and
+    it's debugger integration. If someone likes to integrate **kwargs support,
+    take a look at the publisher.publish method and it's mapply function which
+    get wrapped by the Debugger class. I hope that's fine for now and I
     recommend to avoid kwargs for JSON-RPC methods ;-)
 
-    The z3c.jsonrpcclient JavaScript method JSONRPCProxy converts a 
+    The z3c.jsonrpcclient JavaScript method JSONRPCProxy converts a
     typeof object as arguments[0] to named key/value pair arguments.
 
     """
@@ -150,7 +150,7 @@
         try:
             data = json.read(input)
         except:
-            # catch any error since we don't know which library is used as 
+            # catch any error since we don't know which library is used as
             # parser
             raise ParseError
         # get the params
@@ -159,8 +159,8 @@
             self.jsonId = data.get('id', self._jsonId)
 
         # get the json version. The version 1.0 offers no version argument.
-        # The version 1.1 offers a version key and since version 2.0 the 
-        # version is given with the ``jsonrpc`` key. Let's try to find the 
+        # The version 1.1 offers a version key and since version 2.0 the
+        # version is given with the ``jsonrpc`` key. Let's try to find the
         # version for our request.
         self.jsonVersion = data.get('version', self.jsonVersion)
         self.jsonVersion = data.get('jsonrpc', self.jsonVersion)
@@ -171,7 +171,7 @@
                 # version 1.0 and 1.1 uses a list of arguments
                 for arg in args:
                     if isinstance(arg, dict):
-                        # set every dict key value as form items and support at 
+                        # set every dict key value as form items and support at
                         # least ``:list`` and ``:tuple`` input field name postifx
                         # conversion.
                         for key, d in arg.items():
@@ -192,20 +192,20 @@
                 # This means this library will not support key word arguments
                 # for method calls. It will instead store them in the form.
                 # This has two reasons.
-                # 1. Zope doesn't support kwargs in the publication 
+                # 1. Zope doesn't support kwargs in the publication
                 #    implementation. It only supports positional arguments
                 # 2. The JSON-RPC specification doesn't allow to use positional
                 #     and keyword arguments on one method call
-                # 3. Python doesn't allow to convert kwargs to positional 
+                # 3. Python doesn't allow to convert kwargs to positional
                 #    arguments because a dict doesn't provide an order
                 # This means you should avoid to call a method with kwargs.
                 # just use positional arguments if possible. Or get them from
                 # directly from the request or request.form argument in your
                 # code. Let me know if this is a real problem for you and you
-                # like to implement a different kwarg handling. We have some 
+                # like to implement a different kwarg handling. We have some
                 # ideas for add support for this.
                 args = params
-                # set every dict key value as form items and support at 
+                # set every dict key value as form items and support at
                 # least ``:list`` and ``:tuple`` input field name postifx
                 # conversion.
                 for key, d in args.items():
@@ -239,6 +239,8 @@
             self.setPathSuffix(function)
 
     def traverse(self, object):
+        from pub.dbgpclient import brk; brk('192.168.32.1')
+
         return super(JSONRPCRequest, self).traverse(object)
 
     def keys(self):
@@ -267,14 +269,14 @@
     def setResult(self, result):
         """The result dict contains the following key value pairs
 
-        The version 1.0 and 1.1 provides a response dict with the following 
+        The version 1.0 and 1.1 provides a response dict with the following
         arguments:
 
         id -- json request id
         result -- result or null on error
         error -- error or null if result is Ok
 
-        The version 2.0 provides a response dict with the following named 
+        The version 2.0 provides a response dict with the following named
         paramters:
 
         jsonrpc -- jsonrpc version 2.0 or higher in future versions
@@ -301,7 +303,7 @@
                                      'message': result.message,
                                      'data': result.data},
                            'id': self._request.jsonId}
-    
+
             try:
                 json = zope.component.getUtility(IJSONWriter)
                 result = json.write(wrapper)

Modified: z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/testing.py
===================================================================
--- z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/testing.py	2010-01-26 11:56:40 UTC (rev 108505)
+++ z3c.jsonrpc/branches/adamg-ztk/src/z3c/jsonrpc/testing.py	2010-01-26 11:57:58 UTC (rev 108506)
@@ -45,7 +45,7 @@
 class JSONRPCTestTransport(Transport):
     """Test transport that delegates to zope.app.testing.functional.HTTPCaller.
 
-    It can be used like a normal transport, including support for basic 
+    It can be used like a normal transport, including support for basic
     authentication.
     """
 
@@ -81,7 +81,7 @@
 
 def JSONRPCTestProxy(uri, transport=None, encoding=None, verbose=None,
     jsonId=None, handleErrors=True, jsonVersion=JSON_RPC_VERSION):
-    """A factory that creates a server proxy using the ZopeJSONRPCTestTransport 
+    """A factory that creates a server proxy using the ZopeJSONRPCTestTransport
     by default."""
     if verbose is None:
         verbose = 0
@@ -99,8 +99,8 @@
 ###############################################################################
 
 functional.defineLayer("JSONRPCTestingLayer", "ftesting.zcml")
- 
 
+
 ###############################################################################
 #
 # Test component
@@ -190,15 +190,15 @@
         request_cls, publication_cls = \
             super(HTTPCaller, self).chooseRequestClass(method, path,
                 environment)
-        
+
         content_type = environment.get('CONTENT_TYPE', '')
         is_json = content_type.startswith('application/json')
-    
+
         if method in ('GET', 'POST', 'HEAD'):
             if (method == 'POST' and is_json):
                 request_cls = JSONRPCRequest
                 publication_cls = JSONRPCPublication
-    
+
         return request_cls, publication_cls
 
 
@@ -261,7 +261,7 @@
 
 class FakeModule:
     """A fake module."""
-    
+
     def __init__(self, dict):
         self.__dict = dict
 
@@ -279,7 +279,7 @@
         else:
             name = test.globs.name
 
-    test.globs['__name__'] = name 
+    test.globs['__name__'] = name
     test.globs = NoCopyDict(test.globs)
     sys.modules[name] = FakeModule(test.globs)
 



More information about the checkins mailing list