[Zope-dev] Zope Tests: 5 OK

2008-07-24 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Wed Jul 23 11:00:00 2008 UTC to Thu Jul 24 11:00:00 2008 UTC.
There were 5 messages: 5 from Zope Tests.


Tests passed OK
---

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Tests
Date: Wed Jul 23 21:00:46 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-July/009900.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Tests
Date: Wed Jul 23 21:02:16 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-July/009901.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Tests
Date: Wed Jul 23 21:03:46 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-July/009902.html

Subject: OK : Zope-2.11 Python-2.4.4 : Linux
From: Zope Tests
Date: Wed Jul 23 21:05:16 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-July/009903.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Tests
Date: Wed Jul 23 21:06:48 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-July/009904.html

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: SVN: zope.component/ Merge wichert-utility-factories branch to trunk

2008-07-24 Thread Jacob Holm

Hello

This checkin contains the following change to 
zope.component/trunk/src/zope/component/registry.py
which looks wrong to me (it's a noop).   It looks to me as if the [:2] 
should move outside the ) following it.  I am surprised that this 
doesn't break any tests, as it means that reregistrations are not 
detected as such.


-if (self._utility_registrations.get((provided, name))
+if (self._utility_registrations.get((provided, name)[:2])



Wichert Akkerman wrote:

Log message for revision 88794:
  Merge wichert-utility-factories branch to trunk

Changed:
  D   zope.component/branches/wichert-utility-factories/
  U   zope.component/trunk/README.txt
  U   zope.component/trunk/src/zope/component/interfaces.py
  U   zope.component/trunk/src/zope/component/registry.py
  U   zope.component/trunk/src/zope/component/registry.txt
  U   zope.component/trunk/src/zope/component/zcml.py

-=-
Modified: zope.component/trunk/README.txt
===
--- zope.component/trunk/README.txt 2008-07-24 16:00:26 UTC (rev 88793)
+++ zope.component/trunk/README.txt 2008-07-24 16:17:58 UTC (rev 88794)
@@ -14,6 +14,10 @@
 3.5.0 (unreleased)
 ==
 
+Support registration of utilities via factories through the component registry

+and return factory information in the registration information. This fixes
+https://bugs.launchpad.net/zope3/+bug/240631
+
 Optimized un/registerUtility via storing an optimized data structure for
 efficient retrieval of already registered utilities. This avoids looping over
 all utilities when registering a new one.

Modified: zope.component/trunk/src/zope/component/interfaces.py
===
--- zope.component/trunk/src/zope/component/interfaces.py   2008-07-24 
16:00:26 UTC (rev 88793)
+++ zope.component/trunk/src/zope/component/interfaces.py   2008-07-24 
16:17:58 UTC (rev 88794)
@@ -512,6 +512,7 @@
 Information about the registration of a utility
 
 
+factory = interface.Attribute(The factory used to create the utility. Optional.)

 component = interface.Attribute(The object registered)
 provided = interface.Attribute(The interface provided by the component)
 
@@ -583,9 +584,12 @@

 Register components
 
 
-def registerUtility(component, provided=None, name=u'', info=u''):

+def registerUtility(component=None, provided=None, name=u'', info=u'', 
factory=None):
 Register a utility
 
+factory

+   Factory for the component to be registerd.
+
 component
The registered component
 
@@ -602,10 +606,11 @@

An object that can be converted to a string to provide
information about the registration.
 
+Only one of component and factory can be used.

 A Registered event is generated with an IUtilityRegistration.
 
 
-def unregisterUtility(component=None, provided=None, name=u''):

+def unregisterUtility(component=None, provided=None, name=u'', 
factory=None):
 Unregister a utility
 
 A boolean is returned indicating whether the registry was

@@ -614,6 +619,9 @@
 None and is not registered, then the function returns
 False, otherwise it returns True.
 
+factory

+   Factory for the component to be unregisterd.
+
 component
The registered component The given component can be
None, in which case any component registered to provide
@@ -629,6 +637,7 @@
 name
The utility name.
 
+Only one of component and factory can be used.

 An UnRegistered event is generated with an IUtilityRegistration.
 
 


Modified: zope.component/trunk/src/zope/component/registry.py
===
--- zope.component/trunk/src/zope/component/registry.py 2008-07-24 16:00:26 UTC 
(rev 88793)
+++ zope.component/trunk/src/zope/component/registry.py 2008-07-24 16:17:58 UTC 
(rev 88794)
@@ -65,12 +65,17 @@
 lambda self, bases: self._setBases(bases),
 )
 
-def registerUtility(self, component, provided=None, name=u'', info=u'',

-event=True):
+def registerUtility(self, component=None, provided=None, name=u'', 
info=u'',
+event=True, factory=None):
+if factory:
+if component:
+raise TypeError(Can't specify factory and component.)
+component = factory()
+
 if provided is None:
 provided = _getUtilityProvided(component)
 
-if (self._utility_registrations.get((provided, name))

+if (self._utility_registrations.get((provided, name)[:2])
 == (component, info)):
 # already registered
 return
@@ -81,7 +86,7 @@
 subscribed = True
 break
 
-

[Zope-dev] Re: SVN: zope.component/ Merge wichert-utility-factories branch to trunk

2008-07-24 Thread Wichert Akkerman

Jacob Holm wrote:

Hello

This checkin contains the following change to 
zope.component/trunk/src/zope/component/registry.py
which looks wrong to me (it's a noop).   It looks to me as if the [:2] 
should move outside the ) following it.  I am surprised that this 
doesn't break any tests, as it means that reregistrations are not 
detected as such.


-if (self._utility_registrations.get((provided, name))
+if (self._utility_registrations.get((provided, name)[:2]) 


Excellent catch, fixed.

Wichert.

--
Wichert Akkerman[EMAIL PROTECTED]It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )