[Zope-CMF] ZCML import/export step registration

2007-10-30 Thread Wichert Akkerman
I completed implementation of zcml-based import and export step registration on the wichert-zcml-steps branch. The syntax for import steps is this: genericsetup:importStep name=name title=title description=description

[Zope-CMF] CMF Tests: 11 OK

2007-10-30 Thread CMF Tests Summarizer
Summary of messages to the cmf-tests list. Period Mon Oct 29 13:00:00 2007 UTC to Tue Oct 30 13:00:00 2007 UTC. There were 11 messages: 11 from CMF Unit Tests. Tests passed OK --- Subject: OK : CMF-1.5 Zope-2.7 Python-2.3.6 : Linux From: CMF Unit Tests Date: Mon Oct 29 22:20:40 EDT

[Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Dear all, a simple question with hopefully a simple answer! How do I access objects from an object's context or hierarchy? Specifically I'd like to be able to access a ZopeDA connection for a site. Is it correct that I have to register this somewhere to be able to access it from a portal

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Am 30.10.2007 um 16:19 schrieb robert rottermann: da = getattr('my_da_or_what_ever', context, None) Doesn't that only work within a PythonScript? I need access from within a content type, ie. real Python code? Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel:

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Wichert Akkerman
Previously Charlie Clark wrote: Am 30.10.2007 um 16:19 schrieb robert rottermann: da = getattr('my_da_or_what_ever', context, None) getattr(context, 'my_da_or_what_ever', None) works a bit better. Doesn't that only work within a PythonScript? I need access from within a content type,

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Andrew Sawyers
Charlie Clark wrote: Am 30.10.2007 um 16:19 schrieb robert rottermann: da = getattr('my_da_or_what_ever', context, None) Doesn't that only work within a PythonScript? I need access from within a content type, ie. real Python code? That will work within your content class code as well.

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Andrew Sawyers
Wichert Akkerman wrote: Previously Charlie Clark wrote: Am 30.10.2007 um 16:19 schrieb robert rottermann: da = getattr('my_da_or_what_ever', context, None) getattr(context, 'my_da_or_what_ever', None) works a bit better. Doesn't that only work within a PythonScript? I

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Am 30.10.2007 um 16:53 schrieb Wichert Akkerman: getattr(context, 'my_da_or_what_ever', None) works a bit better. Doesn't that only work within a PythonScript? I need access from within a content type, ie. real Python code? It's called acquisition and it works everywhere. Try it. Yes,

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Andrew Sawyers
Wichert Akkerman wrote: da = getattr('my_da_or_what_ever', context, None) getattr(context, 'my_da_or_what_ever', None) works a bit better. Note that getattr('foo', context, None) is wrong. Wichert has the correct syntax; I didn't even pay attention to the syntax originally. :)

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Andrew Sawyers
Charlie Clark wrote: Am 30.10.2007 um 16:53 schrieb Wichert Akkerman: getattr(context, 'my_da_or_what_ever', None) works a bit better. Doesn't that only work within a PythonScript? I need access from within a content type, ie. real Python code? It's called acquisition and it works

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Am 30.10.2007 um 17:04 schrieb Andrew Sawyers: If it's in a content type's class, why not: id = getattr(self, 'da_id', None) Just using self as the context should be fine. -- that of course presumes that the type is wrapped properly when you call that within your method. mm, currently

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Wichert Akkerman
Previously Charlie Clark wrote: Am 30.10.2007 um 17:04 schrieb Andrew Sawyers: If it's in a content type's class, why not: id = getattr(self, 'da_id', None) Just using self as the context should be fine. -- that of course presumes that the type is wrapped properly when you call that

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Am 30.10.2007 um 17:40 schrieb Wichert Akkerman: __init__ is indeed the wrong place: when the instance is created it is not placed in an acquisition context yet. That would indeed explain things!!! Is it okay to call a method which does this from __init__ ? def __init__(self, id):

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Wichert Akkerman
Previously Charlie Clark wrote: Am 30.10.2007 um 17:40 schrieb Wichert Akkerman: __init__ is indeed the wrong place: when the instance is created it is not placed in an acquisition context yet. That would indeed explain things!!! Is it okay to call a method which does this from

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread robert rottermann
Wichert Akkerman schrieb: Previously Charlie Clark wrote: Am 30.10.2007 um 17:04 schrieb Andrew Sawyers: If it's in a content type's class, why not: id = getattr(self, 'da_id', None) Just using self as the context should be fine. -- that of course presumes that the type is wrapped properly

[Zope-CMF] Re: Accessing the context

2007-10-30 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wichert Akkerman wrote: Previously Charlie Clark wrote: Am 30.10.2007 um 17:40 schrieb Wichert Akkerman: __init__ is indeed the wrong place: when the instance is created it is not placed in an acquisition context yet. That would indeed explain

Re: [Zope-CMF] Accessing the context

2007-10-30 Thread Charlie Clark
Am 30.10.2007 um 18:13 schrieb robert rottermann: there are two places where you can put your code, in both cases acquisition is fully functional. Thanks very much! Now hit an error that my database connection object can't be pickled but at least I can access it! :-D Charlie -- Charlie

[Zope-CMF] Re: Accessing the context

2007-10-30 Thread Rob Miller
robert rottermann wrote: Charlie Clark schrieb: Dear all, a simple question with hopefully a simple answer! How do I access objects from an object's context or hierarchy? Specifically I'd like to be able to access a ZopeDA connection for a site. I if you know the id of the object you are