[Zope3-checkins] SVN: Zope3/trunk/src/zope/ First attempt of getting rid of views' @@ prefix. It just look unnatural

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Oct 27 10:05:05 EDT 2005


Log message for revision 39671:
  First attempt of getting rid of views' @@ prefix. It just look unnatural 
  in a static version.
  
  Cleaned up some text files and strings to be ReST compliant.
  
  Activated Pytohn 2.4 syntax in zope.component/README.txt
  
  

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py
  U   Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml
  U   Zope3/trunk/src/zope/app/apidoc/static.py
  U   Zope3/trunk/src/zope/app/apidoc/utilities.txt
  U   Zope3/trunk/src/zope/app/renderer/rest.py
  U   Zope3/trunk/src/zope/component/README.txt
  U   Zope3/trunk/src/zope/contentprovider/README.txt

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/book.py	2005-10-27 14:05:04 UTC (rev 39671)
@@ -40,7 +40,7 @@
     """
 
 class BookModule(OnlineHelp):
-    """Represent a book compiled from various README.txt and other *.txt
+    """Represent a book compiled from various `README.txt` and other `*.txt`
     documentation files.
     """
 

Modified: Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/app/apidoc/bookmodule/book.zcml	2005-10-27 14:05:04 UTC (rev 39671)
@@ -251,12 +251,6 @@
         parent="zodb"
         doc_path="subtransactions.txt"
         />
-    <bookchapter
-        id="collaborations"
-        title="Collaborations"
-        parent="zodb"
-        doc_path="collaborations.txt"
-        />
   </configure>
 
 </configure>

Modified: Zope3/trunk/src/zope/app/apidoc/static.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/static.py	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/app/apidoc/static.py	2005-10-27 14:05:04 UTC (rev 39671)
@@ -86,9 +86,12 @@
 def completeURL(url):
     """Add file to URL, if not provided."""
     if url.endswith('/'):
-        url += '@@index.html'
+        url += 'index.html'
     if '.' not in url.split('/')[-1]:
-        url += '/@@index.html'
+        url += '/index.html'
+    filename = url.split('/')[-1]
+    if filename.startswith('@@'):
+        url = url.replace(filename, filename[2:])
     return url
 
 def isLocalURL(url):
@@ -234,18 +237,19 @@
 
             for link in links:
                 # Make sure URLs have file extensions, but no parameters
+                original_url = link.url
                 link.url = completeURL(cleanURL(link.url))
                 link.absolute_url = completeURL(cleanURL(link.absolute_url))
-                # Add link to the queue
-                if link.absolute_url not in self.visited:
-                    if isLocalURL(link.url) and isApidocLink(link.absolute_url):
+
+                if isLocalURL(link.url) and isApidocLink(link.absolute_url):
+                    # Add link to the queue
+                    if link.absolute_url not in self.visited:
                         self.linkQueue.insert(0, link)
 
-                # Rewrite URLs
-                if isLocalURL(link.url) and isApidocLink(link.absolute_url):
+                    # Rewrite URLs
                     parts = ['..']*len(segments)
                     parts.append(link.absolute_url.replace(URL, ''))
-                    contents = contents.replace(link.url, '/'.join(parts))
+                    contents = contents.replace(original_url, '/'.join(parts))
 
         # Write the data into the file
         file = open(filepath, 'w')

Modified: Zope3/trunk/src/zope/app/apidoc/utilities.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilities.txt	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/app/apidoc/utilities.txt	2005-10-27 14:05:04 UTC (rev 39671)
@@ -3,7 +3,7 @@
 =======================
 
 The utilities module provides some useful helper functions and classes that
-make the work of the API doctool and inspection code easier. 
+make the work of the API doctool and inspection code easier.
 
   >>> from zope.app.apidoc import utilities
 
@@ -19,7 +19,7 @@
 directory and replaces it with "Zope3".
 
   >>> import os
-  >>> path = os.path.join(utilities.BASEDIR, 'src', 'zope', 'README.txt')  
+  >>> path = os.path.join(utilities.BASEDIR, 'src', 'zope', 'README.txt')
 
   >>> utilities.BASEDIR in path
   True
@@ -42,7 +42,7 @@
 
 
 `truncateSysPath(path)`
-----------------------
+-----------------------
 
 In some cases it is useful to just know the path after the sys path of a
 module. For example, you have a path of a file in a module. To look up the
@@ -58,7 +58,7 @@
 If there is no matching system path, then the whole path is returned:
 
   >>> utilities.truncateSysPath('some/other/path')
-  'some/other/path' 
+  'some/other/path'
 
 
 `ReadContainerBase` (Class)
@@ -105,16 +105,16 @@
 Then naturally, all the other methods work as well:
 
   * `__getitem__(key)`
-  
+
     >>> container['a']
     1
     >>> container['c']
     Traceback (most recent call last):
     ...
     KeyError: 'c'
-  
+
   * `__contains__(key)`
-  
+
     >>> 'a' in container
     True
     >>> 'c' in container
@@ -192,7 +192,7 @@
 Modules are another kind of objects that can return a python path:
 
   >>> utilities.getPythonPath(utilities)
-  'zope.app.apidoc.utilities' 
+  'zope.app.apidoc.utilities'
 
 Passing in `None` returns `None`:
 
@@ -229,7 +229,7 @@
   ...      pass
 
   >>> checker = Checker({'attr': 'zope.Read', 'attr3': CheckerPublic},
-  ...                   {'attr': 'zope.Write', 'attr3': CheckerPublic}) 
+  ...                   {'attr': 'zope.Write', 'attr3': CheckerPublic})
   >>> defineChecker(Sample, checker)
 
 Now let's see how this function works:
@@ -241,7 +241,7 @@
   'zope.Write'
 
   >>> from zope.security.checker import getCheckerForInstancesOf
-  >>> entries = utilities.getPermissionIds('attr', 
+  >>> entries = utilities.getPermissionIds('attr',
   ...                                      getCheckerForInstancesOf(Sample))
   >>> entries['read_perm']
   'zope.Read'
@@ -297,7 +297,7 @@
 And here we mix specified and unspecified keyword arguments:
 
   >>> def func(attr, attr2=None, **kw):
-  ...     pass      
+  ...     pass
   >>> utilities.getFunctionSignature(func)
   '(attr, attr2=None, **kw)'
 
@@ -338,7 +338,7 @@
   '(attr, *args, **kw)'
 
 If you do not pass a function or method to the function, it will fail:
-  
+
   >>> utilities.getFunctionSignature('func')
   Traceback (most recent call last):
   ...
@@ -398,7 +398,7 @@
   ...     def _getAttr(self):
   ...         return self.attr
   ...     attr2 = property(_getAttr)
-  
+
 We can simply pass in the class and get the public attributes:
 
   >>> attrs = utilities.getPublicAttributes(Sample)
@@ -412,7 +412,7 @@
   >>> attrs.sort()
   >>> attrs
   ['attr', 'attr2', 'func']
-  
+
 The function will also take inheritance into account and return all inherited
 attributes as well:
 
@@ -489,7 +489,7 @@
 
 Similarly, it does not make sense if both are specified:
 
-  >>> utilities.getInterfaceForAttribute('getAttr', interfaces=(I1,I2), 
+  >>> utilities.getInterfaceForAttribute('getAttr', interfaces=(I1,I2),
   ...                                    klass=Sample)
   Traceback (most recent call last):
   ...
@@ -511,7 +511,7 @@
 
   >>> utilities.columnize([1, 2, 3], 3)
   [[1], [2], [3]]
-  
+
   >>> utilities.columnize([1, 2, 3, 4], 3)
   [[1, 2], [3], [4]]
 
@@ -523,7 +523,7 @@
 
   >>> utilities.columnize([1, 2, 3], 2)
   [[1, 2], [3]]
-  
+
   >>> utilities.columnize([1, 2, 3, 4], 2)
   [[1, 2], [3, 4]]
 
@@ -532,7 +532,7 @@
 ----------------------
 
 This function inspects a module to determine the supported documentation
-format. The function returns a valid renderer source factory id. 
+format. The function returns a valid renderer source factory id.
 
 If the `__docformat__` module attribute is specified, its value will be used
 to look up the factory id:
@@ -549,7 +549,7 @@
 
 This is a sensible default, since we only decided later in development to
 endorse restructured text, so that many files are still in the structured text
-format. All converted and new modules will have the `__docformat__` attribute. 
+format. All converted and new modules will have the `__docformat__` attribute.
 
 
 `renderText(text, module=None, format=None)`

Modified: Zope3/trunk/src/zope/app/renderer/rest.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/rest.py	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/app/renderer/rest.py	2005-10-27 14:05:04 UTC (rev 39671)
@@ -43,7 +43,7 @@
     - Outputs *only* the 'body' parts of the document tree, using the
       internal docutils structure.
     """
-    
+
     def astext(self):
         """
         This is where we join the document parts that we want in
@@ -62,7 +62,7 @@
       >>> from zope.publisher.browser import TestRequest
       >>> source = ReStructuredTextSourceFactory(u'''
       ... This is source.
-      ... 
+      ...
       ... Header 3
       ... --------
       ... This is more source.
@@ -74,7 +74,7 @@
       <h3><a name="header-3">Header 3</a></h3>
       <p>This is more source.</p>
       </div>
-    """ 
+    """
 
 
     implements(IHTMLRenderer)

Modified: Zope3/trunk/src/zope/component/README.txt
===================================================================
--- Zope3/trunk/src/zope/component/README.txt	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/component/README.txt	2005-10-27 14:05:04 UTC (rev 39671)
@@ -206,14 +206,14 @@
     >>> personJob = interface.implementer(IJob)(personJob)
     >>> personJob = component.adapter(IPerson)(personJob)
 
-(In Python 2.4, the example can be written::
+In Python 2.4, the example can be written:
 
-    @interface.implementer(IJob)
-    @component.adapter(IPerson)
-    def personJob(person):
-        return getattr(person, 'job', None)
+    >>> @interface.implementer(IJob)
+    ... @component.adapter(IPerson)
+    ... def personJob(person):
+    ...     return getattr(person, 'job', None)
 
-which looks a bit nicer.)
+which looks a bit nicer.
 
 In this example, the personJob function simply returns the person's
 `job` attribute if present, or None if it's not present.  An adapter
@@ -228,7 +228,7 @@
     TypeError: ('Could not adapt', ...
 
 The adaptation failed because sally didn't have a job.  Let's give her
-one: 
+one:
 
     >>> job = Job()
     >>> sally.job = job
@@ -248,7 +248,7 @@
     >>> class IValidate(interface.Interface):
     ...     def validate(ob):
     ...         """Determine whether the object is valid
-    ...         
+    ...
     ...         Return a string describing a validation problem.
     ...         An empty string is returned to indicate that the
     ...         object is valid.
@@ -351,7 +351,7 @@
 "handlers".  There are special APIs for registering and calling
 them.
 
-To register the subscriber above, we define a document-created event: 
+To register the subscriber above, we define a document-created event:
 
     >>> class IDocumentCreated(interface.Interface):
     ...     doc = interface.Attribute("The document that was created")
@@ -369,12 +369,11 @@
 
     >>> documentCreated = component.adapter(IDocumentCreated)(documentCreated)
 
-(Note that in Python 2.4, this can be written:
+Note that in Python 2.4, this can be written:
 
-     @component.adapter(IDocumentCreated)
-     def documentCreated(event):
-         event.doc.created = datetime.datetime.utcnow()
-)
+    >>> @component.adapter(IDocumentCreated)
+    ... def documentCreated(event):
+    ...     event.doc.created = datetime.datetime.utcnow()
 
 This marks the handler as an adapter of `IDocumentCreated` events.
 

Modified: Zope3/trunk/src/zope/contentprovider/README.txt
===================================================================
--- Zope3/trunk/src/zope/contentprovider/README.txt	2005-10-27 14:01:10 UTC (rev 39670)
+++ Zope3/trunk/src/zope/contentprovider/README.txt	2005-10-27 14:05:04 UTC (rev 39671)
@@ -82,9 +82,9 @@
 the interface between the content provider world and page templates.
 
 .. [1] Note that this is a bit different from the role named content provider,
-which refers to a service that provides content; the content provider we are
-talking about here are the software components the service would provide to an
-application.
+       which refers to a service that provides content; the content provider
+       we are talking about here are the software components the service would
+       provide to an application.
 
 
 Content Providers



More information about the Zope3-Checkins mailing list