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
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
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
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:
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,
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.
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
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,
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. :)
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
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
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
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):
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
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
-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
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
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
18 matches
Mail list logo