[Zope3-checkins] CVS: Zope3/src/zope/app/services - adapter.py:1.1.2.4 auth.py:1.1.2.4 cache.py:1.1.2.3 configuration.py:1.1.2.5 errorr.py:1.1.2.2 event.py:1.1.2.5 field.py:1.1.2.3 hub.py:1.1.2.4 module.py:1.1.2.2 package.py:1.1.2.4 principalannotation.py:1.1.2.3 role.py:1.1.2.3 service.py:1.1.2.4 session.py:1.1.2.2 test_cookiesessionservice.py:1.1.2.3 view.py:1.1.2.4 viewpackage.py:1.1.2.5 zpt.py:1.1.2.4
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:50 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/services
Modified Files:
Tag: NameGeddon-branch
adapter.py auth.py cache.py configuration.py errorr.py
event.py field.py hub.py module.py package.py
principalannotation.py role.py service.py session.py
test_cookiesessionservice.py view.py viewpackage.py zpt.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/services/adapter.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/adapter.py:1.1.2.3 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/adapter.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Adapter Service
@@ -35,7 +35,7 @@
from zope.app.interfaces.services.interfaces import IAdapterConfiguration
class PersistentAdapterRegistry(Persistent, AdapterRegistry):
-
+
def __init__(self):
AdapterRegistry.__init__(self, PersistentDict())
@@ -63,7 +63,7 @@
adapters = self._byName.get(name)
if adapters is None:
return default
-
+
registry = adapters.getRegistered(forInterface, providedInterface)
if registry is None:
return default
@@ -71,7 +71,7 @@
return ContextWrapper(registry, self)
queryConfigurations = ContextMethod(queryConfigurations)
-
+
def createConfigurationsFor(self, configuration):
"See IConfigurable"
# XXX Need to add named adapter support
@@ -112,7 +112,7 @@
adapters = self._byName.get(name)
if adapters:
-
+
registry = adapters.getForObject(
object, interface,
filter = lambda registry:
@@ -138,7 +138,7 @@
adapters = self._byName.get('')
if adapters is None:
return ()
-
+
return adapters.getRegisteredMatching(for_interfaces,
provided_interfaces)
@@ -163,8 +163,7 @@
def getAdapter(self, object):
sm = getServiceManager(self)
- factory = sm.resolve(self.factoryName)
+ factory = sm.resolve(self.factoryName)
return factory(object)
getAdapter = ContextMethod(getAdapter)
-
=== Zope3/src/zope/app/services/auth.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/auth.py:1.1.2.3 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/auth.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
$Id$
@@ -105,7 +105,7 @@
class User(Persistent):
"""A persistent implementation of the IUser interface """
-
+
__implements__ = IUser, IAttributeAnnotatable
def __init__(self, id, title, description, login, pw):
@@ -125,7 +125,7 @@
roles = annotations.get('roles', [])
roles = removeAllProxies(roles)
return roles
-
+
def validate(self, pw):
'See IReadUser'
return pw == self.__pw
=== Zope3/src/zope/app/services/cache.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/cache.py:1.1.2.2 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/cache.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Caching service.
@@ -63,7 +63,7 @@
getCache = ContextMethod(getCache)
def queryCache(wrapped_self, name, default=None):
- 'See ICachingService'
+ 'See ICachingService'
try:
return wrapped_self.getCache(name)
except KeyError:
=== Zope3/src/zope/app/services/configuration.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/services/configuration.py:1.1.2.4 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/configuration.py Tue Dec 24 21:20:49 2002
@@ -410,4 +410,3 @@
return configuration.getComponent()
return default
queryActiveComponent = ContextMethod(queryActiveComponent)
-
=== Zope3/src/zope/app/services/errorr.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/services/errorr.py:1.1.2.1 Mon Dec 23 14:32:22 2002
+++ Zope3/src/zope/app/services/errorr.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -54,7 +54,7 @@
copy_to_zlog = 0
_ignored_exceptions = ('Unauthorized',)
-
+
def _getLog(self):
"""Returns the log for this object.
Careful, the log is shared between threads.
@@ -80,7 +80,7 @@
strtype = str(getattr(info[0], '__name__', info[0]))
if strtype in self._ignored_exceptions:
return
-
+
if not isinstance(info[2], StringTypes):
tb_text = ''.join(
format_exception(*info, **{'as_html': 0}))
@@ -88,18 +88,18 @@
format_exception(*info, **{'as_html': 1}))
else:
tb_text = info[2]
-
+
url = None
username = None
req_html = None
if request:
url = request.URL
try:
- username = ', '.join((request.user.getLogin(),
- request.user.getId(),
- request.user.getTitle(),
- request.user.getDescription()
- ))
+ username = ', '.join((request.user.getLogin(),
+ request.user.getId(),
+ request.user.getTitle(),
+ request.user.getDescription()
+ ))
# When there's an unauthorized access, request.user is
# not set, so we get an AttributeError
# XXX is this right? Surely request.user should be set!
=== Zope3/src/zope/app/services/event.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/services/event.py:1.1.2.4 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/event.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Event service implementation.
@@ -44,11 +44,11 @@
class LocalSubscribable(Persistent, Subscribable):
"""a local mix-in"""
-
+
__implements__ = (
Subscribable.__implements__,
Persistent.__implements__)
-
+
# uses (and needs) __init__ from zope.event.subscribable
def subscribe(wrapped_self,
@@ -57,19 +57,19 @@
filter=None):
# might be wrapped, might not
subscriber = removeAllProxies(subscriber)
-
+
clean_self = removeAllProxies(wrapped_self)
wrapped_subscriber = ContextWrapper(subscriber, wrapped_self)
-
+
if ISubscriptionAware.isImplementedBy(subscriber):
wrapped_subscriber.subscribedTo(
wrapped_self,
event_type,
filter)
-
+
ev_type = event_type
if ev_type is IEvent: ev_type = None # optimization
-
+
subscribers = clean_self._registry.get(ev_type)
if subscribers is None:
subscribers = []
@@ -83,24 +83,24 @@
break
else:
subs.append((subscriber,{ev_type:1}))
-
+
clean_self._p_changed = 1 #trigger persistence
# XXX should this and similar be done earlier in the method?
# XXX Ask Shane
-
-
+
+
subscribe=ContextMethod(subscribe)
-
+
def unsubscribe(wrapped_self,
subscriber,
event_type = None,
filter = None):
# subscriber might be wrapped, might not
- subscriber = removeAllProxies(subscriber)
-
+ subscriber = removeAllProxies(subscriber)
+
clean_self = removeAllProxies(wrapped_self)
wrapped_subscriber = ContextWrapper(subscriber, wrapped_self)
-
+
for subscriber_index in range(len(clean_self._subscribers)):
sub = clean_self._subscribers[subscriber_index]
if sub[0] == subscriber:
@@ -108,10 +108,10 @@
break
else:
raise NotFoundError(subscriber)
-
-
+
+
do_alert = ISubscriptionAware.isImplementedBy(subscriber)
-
+
if event_type:
ev_type = event_type
if event_type is IEvent:
@@ -151,31 +151,31 @@
del clean_self._subscribers[subscriber_index]
clean_self._p_changed = 1
# XXX should be done earlier? Ask Shane
-
+
unsubscribe = ContextMethod(unsubscribe)
class LocalServiceSubscribable(LocalSubscribable):
"""a local mix-in for services"""
-
+
__implements__ = LocalSubscribable.__implements__
-
+
_serviceName = None # should be replaced; usually done in "bound"
# method of a subclass
-
+
# uses (and needs) __init__ from zope.event.subscribable (via
# localsubscribable)
-
+
def unsubscribe(wrapped_self,
subscriber,
event_type=None,
filter=None):
# might be wrapped, might not
- subscriber = removeAllProxies(subscriber)
-
+ subscriber = removeAllProxies(subscriber)
+
clean_self = removeAllProxies(wrapped_self)
wrapped_subscriber = ContextWrapper(subscriber, wrapped_self)
-
+
for subscriber_index in range(len(clean_self._subscribers)):
sub = clean_self._subscribers[subscriber_index]
if sub[0] == subscriber:
@@ -187,10 +187,10 @@
if next_service is not None:
next_service.unsubscribe(subscriber, event_type, filter)
return
-
-
+
+
do_alert = ISubscriptionAware.isImplementedBy(subscriber)
-
+
if event_type:
# we only have to clean the one event_type out
ev_type = event_type
@@ -240,11 +240,11 @@
next_service.unsubscribe(subscriber, event_type, filter)
clean_self._p_changed = 1 #trigger persistence
unsubscribe = ContextMethod(unsubscribe)
-
+
def listSubscriptions(wrapped_self, subscriber, event_type=None):
# might be wrapped, might not
subscriber = removeAllProxies(subscriber)
-
+
clean_self = removeAllProxies(wrapped_self)
result = LocalSubscribable.listSubscriptions(
clean_self, subscriber, event_type)
@@ -257,15 +257,15 @@
class LocalEventChannel(LocalSubscribable):
-
+
__implements__ = IEventChannel
-
+
# needs __init__ from zope.event.subscribable (via
# localsubscribable)!!
-
+
def notify(wrapped_self, event):
clean_self = removeAllProxies(wrapped_self)
-
+
subscriptionses = clean_self.subscriptionsForEvent(event)
# that's a non-interface shortcut for
# subscriptionses = clean_self._registry.getAllForObject(event)
@@ -280,12 +280,12 @@
class LocalSubscriptionAware:
"mix-in for subscribers that want to know to whom they are subscribed"
-
+
__implements__ = ISubscriptionAware
-
+
def __init__(self):
self._subscriptions = ()
-
+
def subscribedTo(self, subscribable, event_type, filter):
# This breaks for subscriptions to global event service.
# Unless the global event service becomes persistent, this
@@ -293,7 +293,7 @@
subscribable_path = getPhysicalPathString(subscribable)
if (subscribable_path, event_type, filter) not in self._subscriptions:
self._subscriptions += ((subscribable_path, event_type, filter),)
-
+
def unsubscribedFrom(self, subscribable, event_type, filter):
# global event service breaks, as above
subscribable_path = getPhysicalPathString(subscribable)
@@ -309,32 +309,32 @@
"""An event channel that wants to subscribe to the nearest
event service when bound, and unsubscribe when unbound, as one
needs for an event channel that will be a service"""
-
+
__implements__ = (
LocalEventChannel.__implements__,
LocalServiceSubscribable.__implements__,
LocalSubscriptionAware.__implements__,
IBindingAware
)
-
+
def __init__(self):
LocalServiceSubscribable.__init__(self)
LocalSubscriptionAware.__init__(self)
-
+
subscribeOnBind = True
# if true, event service will subscribe
# to the parent event service on binding, unless the parent
# service is the global event service; see 'bound' method
# below
-
+
_serviceName = None
# the name of the service that this object is providing, or
# None if unbound
-
+
_subscribeToServiceName = "Events"
_subscribeToServiceInterface = IEvent
_subscribeToServiceFilter = None
-
+
def bound(wrapped_self, name):
"see IBindingAware"
clean_self = removeAllProxies(wrapped_self)
@@ -351,9 +351,9 @@
clean_self._subscribeToServiceInterface,
clean_self._subscribeToServiceFilter
)
-
+
bound = ContextMethod(bound)
-
+
def unbound(wrapped_self, name):
"see IBindingAware"
clean_self = removeAllProxies(wrapped_self)
@@ -369,14 +369,14 @@
class LocalEventService(ProtoServiceEventChannel):
-
+
__implements__ = (
IEventService,
ProtoServiceEventChannel.__implements__
)
-
+
# uses (and needs) __init__ from base class
-
+
def isPromotableEvent(self, event):
"""a hook. Returns a true value if, when publishing an
event, the event should also be promoted to the
@@ -386,11 +386,11 @@
# this should be (a) kept as is, (b) made into a registry, or
# (c) removed.
return 1
-
+
def publish(wrapped_self, event):
"see IEventService"
clean_self = removeAllProxies(wrapped_self)
-
+
subscriptionses = clean_self._registry.getAllForObject(event)
for subscriptions in subscriptionses:
@@ -408,7 +408,7 @@
getNextService(wrapped_self, 'Events').publish(event)
publishedEvents.remove(event)
publish = ContextMethod(publish)
-
+
def notify(wrapped_self, event):
"see ISubscriber"
clean_self = removeAllProxies(wrapped_self)
@@ -422,7 +422,7 @@
continue
ContextWrapper(subscriber, wrapped_self).notify(event)
notify = ContextMethod(notify)
-
+
def bound(wrapped_self, name):
"see IBindingAware"
clean_self = removeAllProxies(wrapped_self)
@@ -436,9 +436,9 @@
# every startup...
es.subscribe(PathSubscriber(wrapped_self))
bound = ContextMethod(bound)
-
+
# _unbound = ProtoServiceEventChannel.unbound # see comment below
-
+
def unbound(wrapped_self, name):
"see IBindingAware"
clean_self = removeAllProxies(wrapped_self)
@@ -446,7 +446,7 @@
# this flag is used by the unsubscribedFrom method (below) to
# determine that it doesn't need to further unsubscribe beyond
# what we're already doing.
-
+
# Both of the following approaches have wrapper/security
# problems:
#
@@ -464,18 +464,18 @@
clean_self._subscriptions = ()
clean_self._serviceName = None
# end copy/paste
-
+
for subscriber in clean_self._subscribers:
clean_self.__unsubscribeAllFromSelf(wrapped_self, subscriber[0])
# unset flag
clean_self._v_unbinding = None
unbound = ContextMethod(unbound)
-
+
def __unsubscribeAllFromSelf(clean_self, wrapped_self, subscriber):
"""this is *not* an interface function, and should not be used
outside of this class"""
wrapped_subscriber = ContextWrapper(subscriber, wrapped_self)
-
+
for subscriber_index in range(len(clean_self._subscribers)):
sub = clean_self._subscribers[subscriber_index]
if sub[0] == subscriber:
@@ -498,7 +498,7 @@
else: # kept (added back)
subscriptions.append(sub)
del clean_self._subscribers[subscriber_index]
-
+
def unsubscribedFrom(wrapped_self, subscribable, event_type, filter):
"see ISubscriptionAware"
clean_self = removeAllProxies(wrapped_self)
@@ -518,7 +518,7 @@
# of unbinding and notification of unbinding is not
# guaranteed
while removeAllProxies(context) in (
- clean_subscribable, clean_self):
+ clean_subscribable, clean_self):
context = getNextService(context, "Events")
# XXX as usual, we *must not* be working with a global service;
# this probably should raise an error if service is global
@@ -530,13 +530,13 @@
class AbstractIndirectSubscriber:
-
+
def notify(wrapped_self, event):
removeAllProxies(wrapped_self)._getSubscriber(
wrapped_self).notify(event)
-
+
notify=ContextMethod(notify)
-
+
def subscribedTo(wrapped_self, subscribable, event_type, filter):
proxiedObj = removeAllProxies(
wrapped_self)._getSubscriber(wrapped_self)
@@ -544,9 +544,9 @@
removeAllProxies(proxiedObj)):
proxiedObj.subscribedTo(
subscribable, event_type, filter )
-
+
subscribedTo=ContextMethod(subscribedTo)
-
+
def unsubscribedFrom(wrapped_self, subscribable, event_type, filter):
proxiedObj = removeAllProxies(
wrapped_self)._getSubscriber(wrapped_self)
@@ -554,20 +554,20 @@
removeAllProxies(proxiedObj)):
proxiedObj.unsubscribedFrom(
subscribable, event_type, filter )
-
+
unsubscribedFrom=ContextMethod(unsubscribedFrom)
class PathSubscriber(AbstractIndirectSubscriber):
-
+
__implements__ = IPathSubscriber, ISubscriptionAware
-
+
def __init__(self, wrapped_subscriber):
self.subscriber_path = getPhysicalPathString(wrapped_subscriber)
-
+
def __eq__(self, other):
- return (IPathSubscriber.isImplementedBy(other) and
+ return (IPathSubscriber.isImplementedBy(other) and
other.subscriber_path == self.subscriber_path)
-
+
def _getSubscriber(self, wrapped_self):
return traverse(wrapped_self, self.subscriber_path)
=== Zope3/src/zope/app/services/field.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/field.py:1.1.2.2 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/field.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Component location field.
@@ -46,14 +46,14 @@
def _validate(self, value):
super(ComponentLocation, self)._validate(value)
-
+
if not value.startswith('/'):
raise ValidationError("Not an absolute path", value)
-
+
try:
component = traverse(self.context, value)
except NotFoundError:
raise ValidationError("Path for non-existent object", value)
-
+
if not self.type.isImplementedBy(component):
raise ValidationError("Wrong component type")
=== Zope3/src/zope/app/services/hub.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/hub.py:1.1.2.3 Mon Dec 23 18:52:35 2002
+++ Zope3/src/zope/app/services/hub.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Object hub implementation.
@@ -54,7 +54,7 @@
hubid = None
# object = None
# location = None
-
+
def __init__(self, hub, hubid, location=None, object=None):
# we keep all four, to avoid unnecessary lookups
# and to give the objecthub an opportunity to do
@@ -63,7 +63,7 @@
self.hubid = hubid
self.__object = object
self.__location = location
-
+
def __getObject(self):
obj = self.__object
if obj is None:
@@ -71,13 +71,13 @@
return obj
object = property(__getObject)
-
+
def __getLocation(self):
loc = self.__location
if loc is None:
loc = self.__location = self.hub.getLocation(self.hubid)
return loc
-
+
location = property(__getLocation)
@@ -89,14 +89,14 @@
class ObjectUnregisteredHubEvent:
"""We are no longer interested in this object.
-
- """
+
+ """
hub = None
hubid = None
# object = None
location = None
-
+
def __init__(self, hub, hubid, location, object=None):
# location *must* be supplied because the object hub cannot be
# relied upon to translate an unregistered hubid
@@ -106,7 +106,7 @@
self.location = location
__implements__ = IObjectUnregisteredHubEvent
-
+
def __getObject(self):
obj = self.__object
if obj is None:
@@ -115,22 +115,22 @@
return obj
object = property(__getObject)
-
-
+
+
class ObjectModifiedHubEvent(HubEvent):
"""An object with a hubid has been modified."""
-
+
__implements__ = IObjectModifiedHubEvent
-
-
+
+
class ObjectMovedHubEvent(HubEvent):
"""An object with a hubid has had its context changed. Typically, this
means that it has been moved."""
-
+
def __init__(self, hub, hubid, fromLocation, location=None, object=None):
self.fromLocation = fromLocation
HubEvent.__init__(self, hub, hubid, location, object)
-
+
__implements__ = IObjectMovedHubEvent
@@ -144,7 +144,7 @@
hubid = None
object = None
location = None
-
+
def __init__(self, hub, hubid, location, object):
# all four *must* be supplied because the object hub cannot be
# relied upon to translate an unregistered hubid
=== Zope3/src/zope/app/services/module.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/services/module.py:1.1.2.1 Mon Dec 23 14:32:22 2002
+++ Zope3/src/zope/app/services/module.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Manager for persistent modules associated with a service manager.
@@ -47,7 +47,7 @@
class Manager(Persistent):
- __implements__ = IPersistentModuleManager
+ __implements__ = IPersistentModuleManager
# The registry for the manager is the ServiceManager.
# The association between this manager and the registry
=== Zope3/src/zope/app/services/package.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/package.py:1.1.2.3 Mon Dec 23 18:52:35 2002
+++ Zope3/src/zope/app/services/package.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""XXX short summary goes here.
@@ -74,7 +74,7 @@
if not IPackage.isImplementedBy(object):
raise TypeError("Can only add packages")
return super(Packages, self).setObject(name, object)
-
+
@@ -98,5 +98,3 @@
def __init__(self):
super(Package, self).__init__()
self.setObject('configure', ConfigurationManager())
-
-
=== Zope3/src/zope/app/services/principalannotation.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/principalannotation.py:1.1.2.2 Mon Dec 23 18:52:35 2002
+++ Zope3/src/zope/app/services/principalannotation.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Implementation of IPrincipalAnnotationService."""
@@ -43,7 +43,7 @@
# implementation of IPrincipalAnnotationService
-
+
def getAnnotation(self, principalId):
"""Return object implementing IAnnotations for the givin principal.
@@ -54,7 +54,7 @@
return ContextWrapper(self.annotations[principalId], self, name=principalId)
getAnnotation = ContextMethod(getAnnotation)
-
+
def hasAnnotation(self, principalId):
"""Return boolean indicating if given principal has IAnnotations."""
return self.annotations.has_key(principalId)
@@ -80,7 +80,7 @@
raise
__getitem__ = ContextMethod(__getitem__)
-
+
def __setitem__(self, key, value):
self.data[key] = value
=== Zope3/src/zope/app/services/role.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/role.py:1.1.2.2 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/role.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
=== Zope3/src/zope/app/services/service.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/service.py:1.1.2.3 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/service.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -306,4 +306,3 @@
return a
mod += '.' + last
resolve = ContextMethod(resolve)
-
=== Zope3/src/zope/app/services/session.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/services/session.py:1.1.2.1 Mon Dec 23 14:32:22 2002
+++ Zope3/src/zope/app/services/session.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Simplistic session service implemented using cookies.
@@ -41,12 +41,12 @@
"""Session service implemented using cookies."""
__implements__ = Persistent.__implements__, ISessionService, IConfigureSessionService
-
+
def __init__(self):
self.dataManagers = PersistentDict()
self.namespace = "zope3-cs-%x" % (int(time.time()) - 1000000000)
self.secret = "%.20f" % random.random()
-
+
def generateUniqueId(self):
"""Generate a new, random, unique id."""
data = "%.20f%.20f%.20f" % (random.random(), time.time(), time.clock())
@@ -71,11 +71,11 @@
def setRequestId(self, request, id):
"""Set cookie with id on request."""
request.response.setCookie(self.namespace, id, expires=build_http_date(time.time() + 1800))
-
+
#####################################
# Implementation of ISessionService #
-
+
def getSessionId(self, request):
sid = self.getRequestId(request)
if sid is None:
=== Zope3/src/zope/app/services/test_cookiesessionservice.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/test_cookiesessionservice.py:1.1.2.2 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/test_cookiesessionservice.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
from unittest import TestCase, TestLoader, TextTestRunner
@@ -53,11 +53,11 @@
if not abs(parse_http_date(kw["expires"]) - int(time.time()) - 1800) < 3:
raise AssertionError
-
+
class SessionServiceTestCaseMixin(PlacefulSetup):
serviceFactory = None
-
+
def setUp(self):
PlacefulSetup.setUp(self)
self.buildFolders()
@@ -112,7 +112,7 @@
self.svc.setRequestId(req, fakeValue)
self.assertEquals(self.svc.getRequestId(req), None)
-
+
class CookieServiceTestCase(SessionServiceTestCaseMixin, TestCase):
serviceFactory = CookieSessionService
=== Zope3/src/zope/app/services/view.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/view.py:1.1.2.3 Tue Dec 24 07:51:17 2002
+++ Zope3/src/zope/app/services/view.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""View Service
@@ -55,7 +55,7 @@
queryConfigurationsFor = ContextMethod(queryConfigurationsFor)
- def queryConfigurations(self, name, layer,
+ def queryConfigurations(self, name, layer,
forInterface, presentationType, default=None):
names = self._layers.get(layer)
@@ -75,11 +75,11 @@
return ContextWrapper(registry, self)
queryConfigurations = ContextMethod(queryConfigurations)
-
+
def createConfigurationsFor(self, configuration):
"See IConfigurable"
return self.createConfigurations(
- configuration.viewName, configuration.layer,
+ configuration.viewName, configuration.layer,
configuration.forInterface, configuration.presentationType)
createConfigurationsFor = ContextMethod(createConfigurationsFor)
@@ -183,7 +183,7 @@
layers = (layer, )
result = []
-
+
for layer in layers:
names_dict = self._layers.get(layer)
if names_dict is None:
@@ -203,9 +203,9 @@
for match in registry.getRegisteredMatching(
required_interfaces,
presentation_type):
-
+
result.append(match + (layer, viewName))
-
+
return result
class ViewConfiguration(SimpleConfiguration):
@@ -225,15 +225,15 @@
def getView(self, object, request):
sm = getServiceManager(self)
- factory = sm.resolve(self.factoryName)
+ factory = sm.resolve(self.factoryName)
return factory(object, request)
getView = ContextMethod(getView)
-
+
class PageConfiguration(ViewConfiguration):
__implements__ = IPageConfiguration
-
+
def __init__(self,
forInterface, viewName, presentationType,
factoryName=None, template=None,
@@ -251,12 +251,12 @@
factory = sm.resolve(self.factoryName)
else:
factory = DefaultFactory
-
+
view = factory(object, request)
# This is needed because we need to do an unrestricted traverse
root = removeAllProxies(getPhysicalRoot(sm))
-
+
template = traverse(root, self.template)
return BoundTemplate(template, view)
@@ -278,5 +278,3 @@
def __call__(self, *args, **kw):
return self.template.render(self.view, *args, **kw)
-
-
=== Zope3/src/zope/app/services/viewpackage.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/services/viewpackage.py:1.1.2.4 Tue Dec 24 18:20:26 2002
+++ Zope3/src/zope/app/services/viewpackage.py Tue Dec 24 21:20:49 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""View package.
@@ -48,7 +48,7 @@
def setObject(self, name, object):
if not IZPTTemplate.isImplementedBy(object):
raise TypeError("Can only add packages")
-
+
# super() does not work on a context wrapped instance
base = removeAllProxies(self)
@@ -72,4 +72,3 @@
def deactivated(self):
"See IConfiguration"
-
=== Zope3/src/zope/app/services/zpt.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/services/zpt.py:1.1.2.3 Mon Dec 23 18:52:35 2002
+++ Zope3/src/zope/app/services/zpt.py Tue Dec 24 21:20:49 2002
@@ -52,7 +52,7 @@
return namespace
def render(self, view, *args, **keywords):
-
+
if args:
args = ProxyFactory(args)
kw = ProxyFactory(keywords)
@@ -82,7 +82,7 @@
# text was already Unicode, which happens, but unclear how it
# gets converted to Unicode since the ZPTPage stores UTF-8 as
# an 8-bit string.
-
+
if self.page.contentType.startswith('text/html'):
text = tag.sub('', text)