[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Declared docstring
format being 'restructuredtext'.
Florent Xicluna
laxyf at yahoo.fr
Tue Oct 24 04:21:58 EDT 2006
Log message for revision 70897:
Declared docstring format being 'restructuredtext'.
If we omit to declare, code samples are not rendered properly through APIDOC.
Added empty line before code block, if missing.
Removed wrong indentations.
Changed:
U Zope3/trunk/src/zope/app/authentication/ftpplugins.py
U Zope3/trunk/src/zope/app/authentication/idpicker.py
U Zope3/trunk/src/zope/app/authentication/password.py
U Zope3/trunk/src/zope/app/authentication/session.py
U Zope3/trunk/src/zope/app/catalog/attribute.py
U Zope3/trunk/src/zope/app/catalog/catalog.py
U Zope3/trunk/src/zope/app/component/back35.py
U Zope3/trunk/src/zope/app/component/browser/__init__.py
U Zope3/trunk/src/zope/app/onlinehelp/__init__.py
U Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py
U Zope3/trunk/src/zope/app/renderer/plaintext.py
U Zope3/trunk/src/zope/app/renderer/rest.py
U Zope3/trunk/src/zope/app/renderer/stx.py
U Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py
U Zope3/trunk/src/zope/app/security/permission.py
U Zope3/trunk/src/zope/app/security/vocabulary.py
U Zope3/trunk/src/zope/app/securitypolicy/role.py
U Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py
U Zope3/trunk/src/zope/app/tree/utils.py
U Zope3/trunk/src/zope/app/undo/__init__.py
U Zope3/trunk/src/zope/configuration/docutils.py
U Zope3/trunk/src/zope/hookable/__init__.py
U Zope3/trunk/src/zope/i18n/locales/__init__.py
U Zope3/trunk/src/zope/i18n/locales/inheritance.py
U Zope3/trunk/src/zope/interface/ro.py
U Zope3/trunk/src/zope/location/traversing.py
U Zope3/trunk/src/zope/publisher/browser.py
U Zope3/trunk/src/zope/publisher/xmlrpc.py
U Zope3/trunk/src/zope/security/proxy.py
U Zope3/trunk/src/zope/traversing/namespace.py
-=-
Modified: Zope3/trunk/src/zope/app/authentication/ftpplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/ftpplugins.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/authentication/ftpplugins.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -13,6 +13,7 @@
##############################################################################
"""PAS plugins related to FTP
"""
+__docformat__ = 'restructuredtext'
from zope.interface import implements
from zope.publisher.interfaces.ftp import IFTPRequest
Modified: Zope3/trunk/src/zope/app/authentication/idpicker.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/idpicker.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/authentication/idpicker.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import re
from zope.exceptions.interfaces import UserError
from zope.app.container.contained import NameChooser
@@ -28,20 +30,20 @@
The Id picker is a variation on the name chooser that picks numeric
ids when no name is given.
-
+
>>> from zope.app.authentication.idpicker import IdPicker
>>> IdPicker({}).chooseName('', None)
u'1'
-
+
>>> IdPicker({'1': 1}).chooseName('', None)
u'2'
-
+
>>> IdPicker({'2': 1}).chooseName('', None)
u'1'
-
+
>>> IdPicker({'1': 1}).chooseName('bob', None)
u'bob'
-
+
>>> IdPicker({'bob': 1}).chooseName('bob', None)
u'bob1'
Modified: Zope3/trunk/src/zope/app/authentication/password.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/password.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/authentication/password.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,7 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
import md5
import sha
Modified: Zope3/trunk/src/zope/app/authentication/session.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/session.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/authentication/session.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -16,6 +16,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import transaction
from persistent import Persistent
from urllib import urlencode
@@ -87,12 +89,12 @@
The form must provide 'login' and 'password' input fields.
""",
default=u'loginForm.html')
-
+
loginfield = TextLine(
title=u'Loginfield',
description=u"Field of the login page in which is looked for the login user name.",
default=u"login")
-
+
passwordfield = TextLine(
title=u'Passwordfield',
description=u"Field of the login page in which is looked for the password.",
@@ -150,18 +152,18 @@
>>> plugin.extractCredentials(TestRequest())
{'login': 'harry', 'password': 'hirsch'}
-
+
We can also change the fields from which the credentials are extracted:
-
+
>>> plugin.loginfield = "my_new_login_field"
>>> plugin.passwordfield = "my_new_password_field"
-
+
Now we build a request that uses the new fields:
-
+
>>> request = TestRequest(my_new_login_field='luke', my_new_password_field='the_force')
-
+
The plugin now extracts the credentials information from these new fields:
-
+
>>> plugin.extractCredentials(request)
{'login': 'luke', 'password': 'the_force'}
Modified: Zope3/trunk/src/zope/app/catalog/attribute.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/attribute.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/catalog/attribute.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,7 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
import zope.interface
from zope.app.catalog.interfaces import IAttributeIndex
@@ -27,7 +28,7 @@
The class is meant to be mixed with a base class that defines an
index_doc method:
-
+
>>> class BaseIndex(object):
... def __init__(self):
... self.data = []
@@ -64,7 +65,7 @@
>>> index = Index('z')
>>> index.index_doc(11, Data(1))
-
+
The class can also adapt an object to an interface:
>>> from zope.interface import Interface
@@ -81,7 +82,7 @@
>>> class Data2:
... def __init__(self, v):
... self.y = v*v
-
+
>>> index = Index('y', I)
>>> index.index_doc(11, Data(3))
>>> index.index_doc(22, Data(2))
@@ -94,7 +95,7 @@
>>> class Index(AttributeIndex, BaseIndex):
... default_interface = I
... default_field_name = 'y'
-
+
>>> index = Index()
>>> index.index_doc(11, Data(3))
>>> index.index_doc(22, Data(2))
@@ -104,7 +105,7 @@
"""
zope.interface.implements(IAttributeIndex)
-
+
default_field_name = None
default_interface = None
Modified: Zope3/trunk/src/zope/app/catalog/catalog.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/catalog.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/catalog/catalog.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zope.index.interfaces
from zope.interface import implements
from zope.annotation.interfaces import IAttributeAnnotatable
@@ -65,7 +67,7 @@
"""Unregister the data from indexes of this catalog."""
for index in self.values():
index.unindex_doc(docid)
-
+
def _visitSublocations(self) :
"""Restricts the access to the objects that live within
the nearest site if the catalog itself is locatable.
@@ -82,8 +84,8 @@
uidutil = zapi.getUtility(IIntIds)
for uid in uidutil:
yield uid, uidutil.getObject(uid)
-
+
def updateIndex(self, index):
for uid, obj in self._visitSublocations() :
index.index_doc(uid, obj)
@@ -110,11 +112,11 @@
return None
results.sort() # order from smallest to largest
-
+
_, result = results.pop(0)
for _, r in results:
_, result = weightedIntersection(result, r)
-
+
return result
def searchResults(self, **searchterms):
@@ -144,7 +146,7 @@
True
"""
index.__parent__.updateIndex(index)
-
+
def indexDocSubscriber(event):
"""A subscriber to IntIdAddedEvent"""
for cat in zapi.getAllUtilitiesRegisteredFor(ICatalog):
Modified: Zope3/trunk/src/zope/app/component/back35.py
===================================================================
--- Zope3/trunk/src/zope/app/component/back35.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/component/back35.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,7 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
import UserDict
import warnings
@@ -88,7 +89,7 @@
An interface can optionally be specified that describes the interface the
component provides for the registry.
-
+
The interface will be used to produce a proxy for the component, if
the permission is also specified.
"""
@@ -140,7 +141,7 @@
class ILocatedRegistry(IRegistry):
"""A registry that is located in a tree of registries.
-
+
"""
next = interface.Attribute(
"Set the next local registry in the tree. This attribute "
@@ -226,7 +227,7 @@
class IRegisterable(zope.app.container.interfaces.IContained):
"""Mark a component as registerable.
- All registerable components need to implement this interface.
+ All registerable components need to implement this interface.
"""
#zope.app.container.constraints.containers(IRegisterableContainer)
@@ -242,8 +243,8 @@
"""
zope.app.container.constraints.contains(
IRegisterable, IRegisterableContainer)
-
+
class IRegistered(interface.Interface):
"""An object that can track down its registrations.
@@ -810,8 +811,8 @@
self._handler_registrations.extend(())
for sub in self.subs:
sub._evolve_to_generation_4()
-
+
class _OldUtilityRegistrations(UserDict.DictMixin):
def __init__(self, site, rname, name):
@@ -902,7 +903,7 @@
for r in state['_registrations']:
if isinstance(r, UtilityRegistration):
self.register((), r.provided, r.name, r.component)
-
+
if not [
1 for rseen in registrations
if rseen.provided == r.provided
@@ -916,9 +917,9 @@
"Old %s registrations are not supported and will not "
"be converted" % r.__class__.__name__,
DeprecationWarning)
-
+
self._registrations = tuple(registrations)
else:
super(_LocalAdapterRegistryGeneration3SupportMixin, self
).__setstate__(state)
-
+
Modified: Zope3/trunk/src/zope/app/component/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/component/browser/__init__.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/component/browser/__init__.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zope.component
from zope.exceptions.interfaces import UserError
from zope.security.proxy import removeSecurityProxy
@@ -71,7 +73,7 @@
_addFilterInterface = None
def addingInfo(self):
- # A site management folder can have many things. We only want
+ # A site management folder can have many things. We only want
# things that implement a particular interface
info = super(ComponentAdding, self).addingInfo()
if self._addFilterInterface is None:
Modified: Zope3/trunk/src/zope/app/onlinehelp/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/__init__.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/onlinehelp/__init__.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -52,12 +52,14 @@
def getTopicFor(obj, view=None):
"""Determine topic for an object and optionally a view.
+
Iterate through all directly provided Interfaces and
see if for the interface (and view) exists a Help Topic.
Returns the first match.
Prepare the tests:
+
>>> import os
>>> from tests.test_onlinehelp import testdir
>>> from tests.test_onlinehelp import I1, Dummy1, Dummy2
@@ -79,20 +81,24 @@
>>> path = os.path.join(testdir(), 'help.txt')
Register a help topic for the interface 'I1' and the view 'view.html'
+
>>> onlinehelp = OnlineHelp('Help', path)
>>> path = os.path.join(testdir(), 'help2.txt')
>>> onlinehelp.registerHelpTopic('', 'help2', 'Help 2',
... path, I1, 'view.html')
The query should return it ('Dummy1' implements 'I1):
+
>>> getTopicFor(Dummy1(),'view.html').title
'Help 2'
A query without view should not return it
+
>>> getTopicFor(Dummy1()) is None
True
Do the registration again, but without a view:
+
>>> onlinehelp = OnlineHelp('Help', path)
>>> onlinehelp.registerHelpTopic('', 'help2', 'Help 2',
... path, I1, None)
@@ -100,11 +106,13 @@
'Help 2'
Query with view should not match
+
>>> getTopicFor(Dummy1(), 'view.html') is None
True
Query with an object, that does not provide 'I1' should
also return None
+
>>> getTopicFor(Dummy2()) is None
True
Modified: Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import warnings
from zope.component.interfaces import IDefaultViewName
from zope.component.interface import provideInterface
@@ -52,7 +54,7 @@
>>> class Info(object):
... file = u'doctest'
... line = 1
- ...
+ ...
>>> class Context(object):
... info = Info()
... def __init__(self): self.actions = []
@@ -76,7 +78,7 @@
Possibility 2: Providing a custom base interface
------------------------------------------------
-
+
>>> class BaseLayer(IBrowserRequest):
... pass
>>> context = Context()
@@ -145,7 +147,7 @@
from zope.app import layers
if name is not None and ',' in name:
raise TypeError("Commas are not allowed in layer names.")
- if name is None and interface is None:
+ if name is None and interface is None:
raise ConfigurationError(
"You must specify the 'name' or 'interface' attribute.")
if interface and not interface.extends(IBrowserRequest):
@@ -222,7 +224,7 @@
>>> class Info(object):
... file = u'doctest'
... line = 1
- ...
+ ...
>>> class Context(object):
... info = Info()
... def __init__(self): self.actions = []
@@ -233,7 +235,7 @@
Possibility 1: The Old Way
--------------------------
-
+
>>> context = Context()
>>> skin(context, u'skin1', layers=[Layer1, Layer2])
>>> iface = context.actions[3]['args'][1]
@@ -288,7 +290,7 @@
>>> warnings.showwarning = showwarning
"""
from zope.app import skins
- if name is None and interface is None:
+ if name is None and interface is None:
raise ConfigurationError(
"You must specify the 'name' or 'interface' attribute.")
@@ -315,7 +317,7 @@
discriminator = None,
callable = provideInterface,
args = (layer.getName(), layer, ILayer, _context.info)
- )
+ )
else:
path = interface.__module__ + '.' + interface.getName()
@@ -337,7 +339,7 @@
callable = provideInterface,
args = (name, interface, IBrowserSkinType, _context.info)
)
-
+
name = path
# Register the skin interface as an interface
@@ -368,7 +370,7 @@
>>> setDefaultSkin('Skin1')
>>> adapters = zapi.getSiteManager().adapters
- Lookup the default skin for a request that has the
+ Lookup the default skin for a request that has the
>>> adapters.lookup((IBrowserRequest,), IDefaultSkin, '') is Skin1
True
Modified: Zope3/trunk/src/zope/app/renderer/plaintext.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/plaintext.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/renderer/plaintext.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from zope.interface import implements
from zope.publisher.browser import BrowserView
@@ -41,7 +43,7 @@
>>> renderer = PlainTextToHTMLRenderer(source, TestRequest())
>>> renderer.render()
u'This is source.<br />\n'
- """
+ """
implements(IHTMLRenderer)
__used_for__ = IPlainTextSource
Modified: Zope3/trunk/src/zope/app/renderer/rest.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/rest.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/renderer/rest.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import docutils.core, docutils.io
from docutils import nodes, writers
from docutils.writers.html4css1 import HTMLTranslator
Modified: Zope3/trunk/src/zope/app/renderer/stx.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/stx.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/renderer/stx.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import re
from zope.interface import implements
@@ -48,13 +50,13 @@
>>> renderer.render()
u'<p>This is source.</p>\n'
- Make sure that unicode works as well.
+ Make sure that unicode works as well::
>>> source = StructuredTextSourceFactory(u'This is \xc3\x9c.')
>>> renderer = StructuredTextToHTMLRenderer(source, TestRequest())
>>> renderer.render()
u'<p>This is \xc3\x9c.</p>\n'
- """
+ """
implements(IHTMLRenderer)
__used_for__ = IStructuredTextSource
Modified: Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from zope.interface import implements
from zope.app.form.interfaces import IInputWidget
@@ -22,6 +24,7 @@
from zope.app.form.browser.widget import renderElement
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+
class SimpleEditingWidget(TextAreaWidget):
"""Improved textarea editing, with async saving using JavaScript.
@@ -99,7 +102,7 @@
style="width: 98%; font-family: monospace;"
rowTemplate = ViewPageTemplateFile("simpleeditingrow.pt")
rowFragment = ViewPageTemplateFile("simpleeditingrowfragment.pt")
-
+
def _toFieldValue(self, value):
if self.context.min_length and not value:
return None
Modified: Zope3/trunk/src/zope/app/security/permission.py
===================================================================
--- Zope3/trunk/src/zope/app/security/permission.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/security/permission.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,12 +15,16 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from persistent import Persistent
+
from zope.interface import implements
from zope.location import Location
from zope.security.interfaces import IPermission
from zope.app.i18n import ZopeMessageFactory as _
+
NULL_ID = _('<permission not activated>')
##############################################################################
@@ -87,7 +91,7 @@
>>> perm1 = LocalPermission('Permission 1', 'A first permission')
>>> perm1.id = 'perm1'
- >>> import zope.component.interfaces
+ >>> import zope.component.interfaces
>>> event = zope.component.interfaces.Unregistered(
... Registration(perm1, 'perm1'))
Modified: Zope3/trunk/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/security/vocabulary.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/security/vocabulary.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -17,6 +17,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zope.component
from zope.interface import implements, classProvides
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
@@ -30,6 +32,7 @@
from zope.app.component import queryNextUtility
from zope.app.component.vocabulary import UtilityVocabulary
+
class PermissionsVocabulary(UtilityVocabulary):
classProvides(IVocabularyFactory)
interface = IPermission
@@ -48,51 +51,51 @@
To illustrate, we need to register the permission IDs vocab:
- >>> from zope.app.testing.placelesssetup import setUp, tearDown
- >>> setUp()
- >>> from zope.schema.vocabulary import getVocabularyRegistry
- >>> registry = getVocabularyRegistry()
- >>> registry.register('Permission Ids', PermissionIdsVocabulary)
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
+ >>> setUp()
+ >>> from zope.schema.vocabulary import getVocabularyRegistry
+ >>> registry = getVocabularyRegistry()
+ >>> registry.register('Permission Ids', PermissionIdsVocabulary)
We also need to register some sample permission utilities, including
the special permission 'zope.Public':
- >>> from zope.app.security.interfaces import IPermission
- >>> from zope.security.permission import Permission
- >>> from zope.app.testing import ztapi
- >>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
- ... 'zope.Public')
- >>> ztapi.provideUtility(IPermission, Permission('b'), 'b')
- >>> ztapi.provideUtility(IPermission, Permission('a'), 'a')
+ >>> from zope.app.security.interfaces import IPermission
+ >>> from zope.security.permission import Permission
+ >>> from zope.app.testing import ztapi
+ >>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
+ ... 'zope.Public')
+ >>> ztapi.provideUtility(IPermission, Permission('b'), 'b')
+ >>> ztapi.provideUtility(IPermission, Permission('a'), 'a')
We can now lookup these permissions using the vocabulary:
- >>> vocab = registry.get(None, 'Permission Ids')
+ >>> vocab = registry.get(None, 'Permission Ids')
- The non-public permissions 'a' and 'b' are string values:
+ The non-public permissions 'a' and 'b' are string values:
- >>> vocab.getTermByToken('a').value
- u'a'
- >>> vocab.getTermByToken('b').value
- u'b'
+ >>> vocab.getTermByToken('a').value
+ u'a'
+ >>> vocab.getTermByToken('b').value
+ u'b'
However, the public permission value is CheckerPublic:
- >>> vocab.getTermByToken('zope.Public').value is CheckerPublic
- True
+ >>> vocab.getTermByToken('zope.Public').value is CheckerPublic
+ True
and its title is shortened:
- >>> vocab.getTermByToken('zope.Public').title
- u'Public'
+ >>> vocab.getTermByToken('zope.Public').title
+ u'Public'
The terms are sorted by title except for the public permission, which is
listed first:
- >>> [term.title for term in vocab]
- [u'Public', u'a', u'b']
+ >>> [term.title for term in vocab]
+ [u'Public', u'a', u'b']
- >>> tearDown()
+ >>> tearDown()
"""
classProvides(IVocabularyFactory)
Modified: Zope3/trunk/src/zope/app/securitypolicy/role.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/role.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/securitypolicy/role.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,7 +15,10 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from persistent import Persistent
+
from zope.interface import implements
from zope.component import getUtilitiesFor
from zope.location import Location
@@ -25,6 +28,7 @@
from zope.app.i18n import ZopeMessageFactory as _
NULL_ID = _('<role not activated>')
+
class Role(object):
implements(IRole)
Modified: Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -17,6 +17,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zope.component
from zope.interface import implements, classProvides
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
@@ -25,6 +27,7 @@
from zope.app.securitypolicy.interfaces import IRole
from zope.app.securitypolicy.interfaces import IGrantVocabulary
+
class RoleIdsVocabulary(SimpleVocabulary):
"""A vocabular of role IDs.
@@ -33,30 +36,30 @@
To illustrate, we need to register the role IDs vocab:
- >>> from zope.app.testing.placelesssetup import setUp, tearDown
- >>> setUp()
- >>> from zope.schema.vocabulary import getVocabularyRegistry
- >>> registry = getVocabularyRegistry()
- >>> registry.register('Role Ids', RoleIdsVocabulary)
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
+ >>> setUp()
+ >>> from zope.schema.vocabulary import getVocabularyRegistry
+ >>> registry = getVocabularyRegistry()
+ >>> registry.register('Role Ids', RoleIdsVocabulary)
Let's register some sample roles to test against them
- >>> from zope.app.securitypolicy.interfaces import IRole
- >>> from zope.app.securitypolicy.role import Role
- >>> from zope.app.testing import ztapi
- >>> ztapi.provideUtility(IRole, Role('a_id','a_title'), 'a_id')
- >>> ztapi.provideUtility(IRole, Role('b_id','b_title'), 'b_id')
+ >>> from zope.app.securitypolicy.interfaces import IRole
+ >>> from zope.app.securitypolicy.role import Role
+ >>> from zope.app.testing import ztapi
+ >>> ztapi.provideUtility(IRole, Role('a_id','a_title'), 'a_id')
+ >>> ztapi.provideUtility(IRole, Role('b_id','b_title'), 'b_id')
Let's lookup the roles using the vocabulary
- >>> vocab = registry.get(None, 'Role Ids')
+ >>> vocab = registry.get(None, 'Role Ids')
- >>> vocab.getTermByToken('a_id').value
- u'a_id'
- >>> vocab.getTermByToken('b_id').value
- u'b_id'
+ >>> vocab.getTermByToken('a_id').value
+ u'a_id'
+ >>> vocab.getTermByToken('b_id').value
+ u'b_id'
- >>> tearDown()
+ >>> tearDown()
"""
classProvides(IVocabularyFactory)
Modified: Zope3/trunk/src/zope/app/tree/utils.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/utils.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/tree/utils.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zlib
from zope.interface import implements
Modified: Zope3/trunk/src/zope/app/undo/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/__init__.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/app/undo/__init__.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from datetime import datetime
import transaction
@@ -127,7 +129,7 @@
entries = self.__db.undoInfo(first, last, specification)
- # We walk through the entries, augmenting the dictionaries
+ # We walk through the entries, augmenting the dictionaries
# with some additional items we have promised in the interface
for entry in entries:
entry['datetime'] = datetime.fromtimestamp(entry['time'])
Modified: Zope3/trunk/src/zope/configuration/docutils.py
===================================================================
--- Zope3/trunk/src/zope/configuration/docutils.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/configuration/docutils.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import re
para_sep = re.compile('\n{2,}')
Modified: Zope3/trunk/src/zope/hookable/__init__.py
===================================================================
--- Zope3/trunk/src/zope/hookable/__init__.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/hookable/__init__.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -76,6 +76,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from _zope_hookable import *
# DocTest:
Modified: Zope3/trunk/src/zope/i18n/locales/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18n/locales/__init__.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/i18n/locales/__init__.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import os
from datetime import datetime, date
from time import strptime
@@ -166,7 +168,7 @@
>>> locale.displayNames = LocaleDisplayNames()
>>> locale.displayNames.keys = ['fu', 'bahr']
- Here you can see the inheritance in action
+ Here you can see the inheritance in action::
>>> locale.displayNames.languages
['en', 'de']
@@ -240,10 +242,10 @@
available for this locale. This was done, since most other calendars have
different year and era data, but everything else remains the same.
- Example::
+ Example:
- Even though the 'Locale' object has no 'calendar' attribute for real, it
- helps us here to make the example simpler.
+ Even though the 'Locale' object has no 'calendar' attribute for real, it
+ helps us here to make the example simpler.
>>> from zope.i18n.locales.tests.test_docstrings import \\
... LocaleInheritanceStub
@@ -286,7 +288,7 @@
>>> locale.calendar.getDayTypeFromAbbreviation(u'Die')
2
- Let's test the direct attribute access as well.
+ Let's test the direct attribute access as well.
>>> root.am = u'AM'
>>> root.pm = u'PM'
@@ -373,7 +375,7 @@
>>> dates.calendars = {'gregorian': cal}
Setting up and accessing date format through a specific length
- (very common scenario)
+ (very common scenario)::
>>> fulllength = LocaleFormatLength()
>>> format = LocaleFormat()
@@ -396,7 +398,7 @@
>>> formatter.format(date(2004, 02, 04))
u'Mittwoch, 4. Februar 2004'
- Let's also test the time formatter
+ Let's also test the time formatter::
>>> fulllength = LocaleFormatLength()
>>> format = LocaleFormat()
@@ -420,7 +422,7 @@
u'12:15 Uhr +000'
The datetime formatter is a bit special, since it is constructed from
- the other two:
+ the other two::
>>> length = LocaleFormatLength()
>>> format = LocaleFormat()
@@ -436,7 +438,7 @@
>>> formatter.format(datetime(2004, 02, 04, 12, 15, 00))
u'Mittwoch, 4. Februar 2004 12:15 Uhr +000'
- Finally, we'll test some invalid input:
+ Finally, we'll test some invalid input::
>>> dates.getFormatter('timeDate')
Traceback (most recent call last):
@@ -515,7 +517,7 @@
class LocaleNumbers(AttributeInheritance):
"""Implementation of ILocaleCurrency including inheritance support.
-` Examples::
+ Examples::
>>> numbers = LocaleNumbers()
>>> numbers.symbols = {
@@ -524,8 +526,8 @@
... 'minusSign': '-', 'exponential': 'E', 'perMille': 'o/oo',
... 'infinity': 'oo', 'nan': 'N/A'}
- Setting up and accessing totally unnamed decimal format
- (very common scenario)
+ Setting up and accessing totally unnamed decimal format
+ (very common scenario)::
>>> length = LocaleFormatLength()
>>> format = LocaleFormat()
@@ -540,7 +542,7 @@
>>> formatter.format(3210.4)
u'3.210,4'
- Setting up and accessing scientific formats with named format lengths
+ Setting up and accessing scientific formats with named format lengths::
>>> longlength = LocaleFormatLength('long')
>>> format = LocaleFormat()
@@ -560,8 +562,8 @@
>>> formatter.format(1234.5678)
u'1,2346E+03'
- Setting up and accessing percent formats with named format lengths
- and format names
+ Setting up and accessing percent formats with named format lengths
+ and format names::
>>> longlength = LocaleFormatLength('long')
>>> fooformat = LocaleFormat()
@@ -578,7 +580,7 @@
>>> formatter.format(123.45678)
u'123%'
- ...using a default name
+ ...using a default name::
>>> numbers.percentFormats['long'].default = 'bar'
>>> formatter = numbers.getFormatter('percent')
Modified: Zope3/trunk/src/zope/i18n/locales/inheritance.py
===================================================================
--- Zope3/trunk/src/zope/i18n/locales/inheritance.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/i18n/locales/inheritance.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -16,10 +16,12 @@
This module provides support for locale inheritance.
Note: In many respects this is similar to Zope 2's acquisition model, since
-locale inheritance is not inheritance in the programming sense.
+locale inheritance is not inheritance in the programming sense.
$Id$
"""
+__docformat__ = 'restructuredtext'
+
from zope.interface import implements
from zope.i18n.interfaces.locales import \
ILocaleInheritance, IAttributeInheritance, IDictionaryInheritance
@@ -64,33 +66,33 @@
>>> root.data = 'value'
>>> root.attr = 'bar value'
>>> root.data2 = AttributeInheritance()
- >>> root.data2.attr = 'value2'
+ >>> root.data2.attr = 'value2'
>>> locale = LocaleInheritanceStub(root)
>>> locale.attr = 'foo value'
>>> locale.data2 = AttributeInheritance()
- Here is an attribute lookup directly from the locale ...
+ Here is an attribute lookup directly from the locale::
>>> locale.data
'value'
>>> locale.attr
'foo value'
- ... however, we can also have any amount of nesting.
+ ... however, we can also have any amount of nesting::
>>> locale.data2.attr
'value2'
- Once we have looked up a particular attribute, it should be cached,
- i.e. exist in the dictionary of this inheritance object.
+ Once we have looked up a particular attribute, it should be cached,
+ i.e. exist in the dictionary of this inheritance object::
>>> 'attr' in locale.data2.__dict__
True
>>> locale.data2.__dict__['attr']
'value2'
- Make sure that None can be assigned as value as well.
+ Make sure that None can be assigned as value as well::
>>> locale.data2.attr = None
>>> locale.data2.attr is None
@@ -102,8 +104,8 @@
def __setattr__(self, name, value):
"""See zope.i18n.interfaces.locales.ILocaleInheritance"""
# If we have a value that can also inherit data from other locales, we
- # set its parent and name, so that we know how to get to it.
- if (ILocaleInheritance.providedBy(value) and
+ # set its parent and name, so that we know how to get to it.
+ if (ILocaleInheritance.providedBy(value) and
not name.startswith('__')):
value.__parent__ = self
value.__name__ = name
@@ -130,9 +132,9 @@
# which we do not want to override.
super(AttributeInheritance, self).__setattr__(name, value)
return value
-
+
class InheritingDictionary(Inheritance, dict):
"""Implementation of a dictionary that can also inherit values.
@@ -151,23 +153,23 @@
>>> locale.data2 = AttributeInheritance()
>>> locale.data2.dict = InheritingDictionary({1: 'I'})
- Here is a dictionary lookup directly from the locale ...
+ Here is a dictionary lookup directly from the locale::
>>> locale.data[1]
'eins'
>>> locale.data[2]
'two'
- ... however, we can also have any amount of nesting.
+ ... however, we can also have any amount of nesting::
>>> locale.data2.dict[1]
'I'
>>> locale.data2.dict[2]
'ii'
- We also have to overwrite 'get()', 'keys()' and 'items()' since we want
- to make sure that all upper locales are consulted before returning the
- default or to construct the list of elements, respectively.
+ We also have to overwrite 'get()', 'keys()' and 'items()' since we want
+ to make sure that all upper locales are consulted before returning the
+ default or to construct the list of elements, respectively::
>>> locale.data2.dict.get(2)
'ii'
@@ -191,7 +193,7 @@
def __getitem__(self, name):
"""See zope.i18n.interfaces.locales.ILocaleInheritance"""
if not self.has_key(name):
- try:
+ try:
selfUp = self.getInheritedSelf()
except NoParentException:
pass
@@ -219,5 +221,5 @@
def value(self):
return [item[1] for item in self.items()]
-
-
+
+
Modified: Zope3/trunk/src/zope/interface/ro.py
===================================================================
--- Zope3/trunk/src/zope/interface/ro.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/interface/ro.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,7 +15,9 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
def ro(object):
"""Compute a "resolution order" for an object
"""
Modified: Zope3/trunk/src/zope/location/traversing.py
===================================================================
--- Zope3/trunk/src/zope/location/traversing.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/location/traversing.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import zope.component
import zope.interface
from zope.traversing.interfaces import IPhysicallyLocatable
Modified: Zope3/trunk/src/zope/publisher/browser.py
===================================================================
--- Zope3/trunk/src/zope/publisher/browser.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/publisher/browser.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -20,6 +20,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import re
from types import ListType, TupleType, StringType
from cgi import FieldStorage
Modified: Zope3/trunk/src/zope/publisher/xmlrpc.py
===================================================================
--- Zope3/trunk/src/zope/publisher/xmlrpc.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/publisher/xmlrpc.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -17,6 +17,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import sys
import xmlrpclib
import datetime
Modified: Zope3/trunk/src/zope/security/proxy.py
===================================================================
--- Zope3/trunk/src/zope/security/proxy.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/security/proxy.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,7 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
from warnings import warn
@@ -65,10 +66,10 @@
>>> from zope.security.checker import ProxyFactory
>>> isinstance(ProxyFactory(c), C1)
True
-
+
"""
# The removeSecurityProxy call is OK here because it is *only*
# being used for isinstance
-
+
return builtin_isinstance(removeSecurityProxy(object), cls)
Modified: Zope3/trunk/src/zope/traversing/namespace.py
===================================================================
--- Zope3/trunk/src/zope/traversing/namespace.py 2006-10-23 21:06:10 UTC (rev 70896)
+++ Zope3/trunk/src/zope/traversing/namespace.py 2006-10-24 08:21:55 UTC (rev 70897)
@@ -15,6 +15,8 @@
$Id$
"""
+__docformat__ = 'restructuredtext'
+
import re
import zope.component
@@ -28,6 +30,7 @@
from zope.traversing.interfaces import ITraversable, IPathAdapter
from zope.traversing.interfaces import TraversalError, IContainmentRoot
+
class UnexpectedParameters(TraversalError):
"Unexpected namespace parameters were provided."
@@ -437,7 +440,7 @@
no adapter
Clean up:
-
+
>>> from zope.testing.cleanup import cleanUp
>>> cleanUp()
"""
More information about the Zope3-Checkins
mailing list