Re: [Zope-dev] Re: unregistering components?

2007-11-25 Thread Chris Withers

Philipp von Weitershausen wrote:

On 25 Nov 2007, at 13:37 , Chris Withers wrote:

Philipp von Weitershausen wrote:

class IComponentRegistry(interface.Interface):

I think you should use zope.component.getGlobalSiteManager() for this.


So getGlobalSiteManager returns a component registry?


Yes. It returns the one and only global registry.


Am I right in thinking the global registry is _only_ used if no context 
is supplied?



If so, how come it's not called getGlobalComponentRegistry?


Because component registries used to be called site managers and we 
can't just change the API at this point anymore.


Well, getGlobalComponentRegistry could be added as an alternate spelling 
and people could be encouraged to use it ;-)


There seems to be comments suggesting getSiteManager is deprecated, but 
maybe I'm not getting exactly what is being deprecated...


How do you set up nested registries? For example, if a certain area of 
a site should have a registry which overrides the global one, but only 
for that area, and should fall back on it if not adapter could be found?


You use sites. Sites are places (usually containers) in the component 
hierarchy that have (local) component registries associated with them. 


So, by "component heirarchy" I'm guessing you really mean "object 
hierarchy" and by "Site" you mean "something implementing 
IComponentRegistry"? If I'm off base, please say...


I'm guessing the adapter to IComponentLookup is what implements the 
search up the object graph to find an IComponentRegistry? If so, where 
do I find that adapter implementation(s)?


And yes, the name "site" is misleading, but again, we have it as legacy 
now. How to work with sites, how to set them up, etc. is all explained 
in my book. I'm sure you have a copy :)


I do, and I'm very greatful for it...

(Btw, this thread has nothing to do with the development *of* Zope and 
is therefore [EMAIL PROTECTED] or [EMAIL PROTECTED] rather than 
zope-dev@zope.org material.)


...however, I'm interested in the mechanics of how zope.component 
handles multiple component registries, in particular how registries are 
added to and removed from the set of registries that are searched hen 
looking for a component and some other bits and pieces.


In short, if the current zope.component implementation already does what 
I want, or whether I need to do work on the development *of* it it order 
to get what I'm after...


...of course, I don't know exactly what I'm after yet, but I hope you'll 
bear with my questions in the meantime ;-)


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
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: deferredimport?

2007-11-25 Thread Chris Withers

Philipp von Weitershausen wrote:

Chris Withers wrote:

Is deferredimport handy for dealing with circular import problems,


Sure.


Is this it's primary reason for existence?


  Often, especially for package modules, you want to import names for
  convenience, but not actually perform the imports until necessary.
  The zope.deferredimport package provided facilities for defining names
  in modules that will be imported from somewhere else when used.  You
  can also cause deprecation warnings to be issued when a variable is
  used, but we'll get to that later.


Well, this says what it does but not why it was written...

(Btw, this thread has nothing to do with the development *of* Zope and 


That's not strictly speaking true ;-)

I bumped into zope.deferredimport while reading the code in 
zope.component's __init__.py which uses zope.deferredimport quite 
heavilly... however, the comment for r67110 suggests the creation of 
zope.component._api was due to circular import problems.


If zope.deferredimport solves these problems, why was ._api needed?

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
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] Escaping special characters in ZCTextIndex.QueryParser?

2007-11-25 Thread Robert Casties
Hi,

is it possible to escape parentheses in ZCTextIndex searches?

If not, why not and how can I do a simple search in an index bypassing
the QueryParser?

I have an index where words can contain parentheses and I am unable to
enter a query for these words because the QueryParser interprets all
parentheses as search expression groupings.

Enclosing the words with double quotes has not helped, neither have
backslashes...

Is there a way other than having to write a new ZCTextIndex?

Thanks for any insight

Robert

___
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: deferredimport?

2007-11-25 Thread Philipp von Weitershausen

Chris Withers wrote:

Is deferredimport handy for dealing with circular import problems,


Sure.


or was it targetted at solving another problem?


From zope.deferredimport/trunk/src/zope/deferredimport/README.txt or 
its PyPI page (http://pypi.python.org/pypi/zope.deferredimport/3.4.0):


  Often, especially for package modules, you want to import names for
  convenience, but not actually perform the imports until necessary.
  The zope.deferredimport package provided facilities for defining names
  in modules that will be imported from somewhere else when used.  You
  can also cause deprecation warnings to be issued when a variable is
  used, but we'll get to that later.


(Btw, this thread has nothing to do with the development *of* Zope and 
is therefore [EMAIL PROTECTED] or [EMAIL PROTECTED] rather than 
zope-dev@zope.org material.)

___
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 )


Re: [Zope-dev] Re: unregistering components?

2007-11-25 Thread Philipp von Weitershausen

On 25 Nov 2007, at 13:37 , Chris Withers wrote:

Philipp von Weitershausen wrote:

class IComponentRegistry(interface.Interface):
I think you should use zope.component.getGlobalSiteManager() for  
this.


So getGlobalSiteManager returns a component registry?


Yes. It returns the one and only global registry.


If so, how come it's not called getGlobalComponentRegistry?


Because component registries used to be called site managers and we  
can't just change the API at this point anymore.


How do you set up nested registries? For example, if a certain area  
of a site should have a registry which overrides the global one, but  
only for that area, and should fall back on it if not adapter could  
be found?


You use sites. Sites are places (usually containers) in the component  
hierarchy that have (local) component registries associated with them.  
And yes, the name "site" is misleading, but again, we have it as  
legacy now. How to work with sites, how to set them up, etc. is all  
explained in my book. I'm sure you have a copy :)


(Btw, this thread has nothing to do with the development *of* Zope and  
is therefore [EMAIL PROTECTED] or [EMAIL PROTECTED] rather than zope-dev@zope.org 
 material.)

___
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] Zope Tests: 5 OK

2007-11-25 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Sat Nov 24 13:00:00 2007 UTC to Sun Nov 25 13:00:00 2007 UTC.
There were 5 messages: 5 from Zope Unit Tests.


Tests passed OK
---

Subject: OK : Zope-2.7 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Sat Nov 24 20:51:20 EST 2007
URL: http://mail.zope.org/pipermail/zope-tests/2007-November/008696.html

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Sat Nov 24 20:52:50 EST 2007
URL: http://mail.zope.org/pipermail/zope-tests/2007-November/008697.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Nov 24 20:54:21 EST 2007
URL: http://mail.zope.org/pipermail/zope-tests/2007-November/008698.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Nov 24 20:55:51 EST 2007
URL: http://mail.zope.org/pipermail/zope-tests/2007-November/008699.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Nov 24 20:57:21 EST 2007
URL: http://mail.zope.org/pipermail/zope-tests/2007-November/008700.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 )


Re: [Zope-dev] Re: unregistering components?

2007-11-25 Thread Chris Withers

Philipp von Weitershausen wrote:

class IComponentRegistry(interface.Interface):


I think you should use zope.component.getGlobalSiteManager() for this.


So getGlobalSiteManager returns a component registry?
If so, how come it's not called getGlobalComponentRegistry?

How do you set up nested registries? For example, if a certain area of a 
site should have a registry which overrides the global one, but only for 
that area, and should fall back on it if not adapter could be found?


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
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] deferredimport?

2007-11-25 Thread Chris Withers

Hi All,

Is deferredimport handy for dealing with circular import problems, or 
was it targetted at solving another problem?


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
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 )


Re: [Zope-dev] Re: unregistering components?

2007-11-25 Thread Baiju M
- "Philipp von Weitershausen" <[EMAIL PROTECTED]> wrote:
> Wichert Akkerman wrote:
> > Previously Ross Patterson wrote:
> >> Chris Withers <[EMAIL PROTECTED]> writes:
> >>
> >>> Hi All,
> >>>
> >>> Does the component architecture support un-registering adapters
> and
> >>> the like?
> >> >From zope.component.interfaces:
> >>
> >> class IComponentRegistry(interface.Interface):
> >> """Register components
> >> """
> >> 
> >> def unregisterUtility(component=None, provided=None,
> name=u''):
> >> """Unregister a utility
> >> 
> >> def unregisterAdapter(factory=None, required=None,
> >>   provided=None, name=u''):
> >> """Register an adapter factory
> >> 
> >> def unregisterSubscriptionAdapter(factory=None, required=None,
> >>   provides=None, name=u''):
> >> """Unregister a subscriber factory.
> >> 
> >> def unregisterHandler(handler=None, required=None, name=u''):
> >> """Unregister a handler.
> >> 
> >>
> >> That'll do it, I think.  :)
> > 
> > You need a bit of extra information that is not in the interface:
> where
> > to find the registry. To get the global registry you can do this:
> > 
> >from zope.component.globalregistry import base as base_registry
> 
> I think you should use zope.component.getGlobalSiteManager() for
> this.

FWIW, I started documenting the complete API here:

http://www.muthukadan.net/docs/zca.html

Regards,
Baiju M

___
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 )