[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/apidoc/presentation.py Bugfix, APIDoc will not find the correct path for

Roger Ineichen roger at projekt01.ch
Sat Dec 3 22:06:35 EST 2005


Log message for revision 40523:
  Bugfix, APIDoc will not find the correct path for 
  the 3rd party package jsonserver josnrpc views.
  And the apidoc tests will fail if a jsonrpc view get registred.
  Since this is a bug related to apidoc and not jsonserver, I added 
  a simply fix to the method getViewFactoryData.
  
  I added the correct package location where is used
  as a string. This will not add a dependency.
  I think we have to find another way where allows 
  3rd party packages to register it's own logic for 
  find the module path. Otherwise we can also remove this information
  for unknown modules.
  
  See issue http://www.zope.org/Collectors/Zope3-dev/504 
  for more information.

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/presentation.py

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/presentation.py	2005-12-04 02:24:39 UTC (rev 40522)
+++ Zope3/trunk/src/zope/app/apidoc/presentation.py	2005-12-04 03:06:34 UTC (rev 40523)
@@ -38,6 +38,7 @@
 
 BROWSER_DIRECTIVES_MODULE = 'zope.app.publisher.browser.viewmeta'
 XMLRPC_DIRECTIVES_MODULE = 'zope.app.publisher.xmlrpc.metaconfigure'
+JSONRPC_DIRECTIVES_MODULE = 'jsonserver.metaconfigure'
 
 def getViewFactoryData(factory):
     """Squeeze some useful information out of the view factory"""
@@ -74,6 +75,15 @@
         # Those factories are method publisher and security wrapped
         info['path'] = getPythonPath(factory.__bases__[0].__bases__[0])
 
+    # JSON-RPC view factory, generated during registration
+    # This is needed for the 3rd party jsonserver implementation
+    # TODO: See issue http://www.zope.org/Collectors/Zope3-dev/504, ri
+    elif factory.__module__ is not None and \
+             factory.__module__.startswith(JSONRPC_DIRECTIVES_MODULE):
+
+        # Those factories are method publisher and security wrapped
+        info['path'] = getPythonPath(factory.__bases__[0].__bases__[0])
+
     # A factory that is a class instance; since we cannot reference instances,
     # reference the class.
     elif not hasattr(factory, '__name__'):



More information about the Zope3-Checkins mailing list