Martijn Faassen wrote:
[snip Jim helping me]
Okay, that's one step closer to support for this in the annotation
package, thanks!
I've checked this in last night. There's a README.txt in
zope.app.annotation now too that explains its usage.
Regards,
Martijn
Philipp von Weitershausen wrote:
Martijn Faassen wrote:
I stand by my conclusions on this approach sounding simple in theory,
but still being a bit harder than it should be in practice. :)
I think this is pretty simple:
def makeAnnotationAdapter(for_, factory, key):
Martijn Faassen wrote:
Philipp von Weitershausen wrote:
Martijn Faassen wrote:
I stand by my conclusions on this approach sounding simple in theory,
but still being a bit harder than it should be in practice. :)
I think this is pretty simple:
def makeAnnotationAdapter(for_, factory,
Jean-Marc Orliaguet wrote:
[snip]
excuse me, but can someone explain what problem the pattern / workaround
is supposed to fix, does it create and return a default annotation value
in case an annotation key does not exist? shouldn't the annotation
machinery be fixed instead to provide
Martijn Faassen wrote:
Jean-Marc Orliaguet wrote:
[snip]
excuse me, but can someone explain what problem the pattern /
workaround is supposed to fix, does it create and return a default
annotation value in case an annotation key does not exist? shouldn't
the annotation machinery be fixed
Jean-Marc Orliaguet wrote:
[snip]
OK, basically you mean that the 'annotations' given in your original
post should implement a 'setdefault' method?
I don't see how that would help - you'd still end up writing a factory
that uses the setdefault, right?
I don't want to keep repeating factory
Martijn Faassen wrote:
Jean-Marc Orliaguet wrote:
[snip]
OK, basically you mean that the 'annotations' given in your original
post should implement a 'setdefault' method?
I don't see how that would help - you'd still end up writing a factory
that uses the setdefault, right?
I don't want
Jim Fulton wrote:
Philipp von Weitershausen wrote:
Marius Gedminas wrote:
I'd prefer
from zope.annotation.adapter import AnnotationAdapter
getFoo = AnnotationAdapter(for_=IBar,
interface=IFoo,
factory=Foo,
Jim Fulton wrote:
Martijn Faassen wrote:
...
I just tried to write AnnotationAdapter. Unfortunately, I haven't
gotten very far yet, as it turns out I need to understand the
internals of the implementation of the zope:adapter ZCML statement.
No, you don't.
zope:adapter has a bunch of
Martijn Faassen wrote:
Jim Fulton wrote:
...
If a factory is not a class, and if it allows attributes to be
set on it, then the interface.implementor function can be used to make
declarations for it. This is documeted in zope/interfaces/README.txt
and zope/component/README.txt.
Jim Fulton wrote:
Martijn Faassen wrote:
Jim Fulton wrote:
This is one bit I was missing, thanks.
Unfortunately I read in zope/interface/README.txt that the
'implementer' function cannot be used for classes yet, so this will
change the design somewhat (I was using __call__, looks like
Martijn Faassen wrote:
...
Then this and the __component_adapts__ hack should be enough to make it
work (still an unpleasant hack, that).
Huh? Use adapter.
class FactoryFactory:
def __init__(self):
# initialize a new factory
...
implementer(self,
Jim Fulton wrote:
Martijn Faassen wrote:
...
Then this and the __component_adapts__ hack should be enough to make
it work (still an unpleasant hack, that).
Huh? Use adapter.
class FactoryFactory:
def __init__(self):
# initialize a new factory
...
On 3/15/06, Martijn Faassen [EMAIL PROTECTED] wrote:
In the new world for ZCML, ZCML as a language falls apart in a
minimalistic XML language, and some support code (such as
zope.app.annotation.AnnotationFactory) to help it do more advanced things.
That's what I'd like to see! :)
One
Martijn Faassen wrote:
I stand by my conclusions on this approach sounding simple in theory,
but still being a bit harder than it should be in practice. :)
I think this is pretty simple:
def makeAnnotationAdapter(for_, factory, key):
@zope.component.adapter(for_)
Philipp von Weitershausen wrote:
Marius Gedminas wrote:
I'd prefer
from zope.annotation.adapter import AnnotationAdapter
getFoo = AnnotationAdapter(for_=IBar,
interface=IFoo,
factory=Foo,
Lennart Regebro wrote:
On 3/10/06, Martijn Faassen [EMAIL PROTECTED] wrote:
For instance, one that looks like this:
zope:annotation for=IBar factory=Foo /
That doesn't look like configuration.
No, it's an on/off switch. Me likesss it.
Philipp
Marius Gedminas wrote:
I'd prefer
from zope.annotation.adapter import AnnotationAdapter
getFoo = AnnotationAdapter(for_=IBar,
interface=IFoo,
factory=Foo,
key=FOO_KEY)
# I suppose
On Sat, 11 Mar 2006 00:49:19 -, Marius Gedminas [EMAIL PROTECTED]
wrote:
I think this is exactly the same as Jeff Shell's suggestion, but its
3am, and I'm too tired to read his entire message.
I find I have that problem even at more sociable hours of the day
(depending on whom you
On Fri, 2006-10-03 at 17:17 -0700, Jeff Shell wrote:
But I beg you not to add to the ZCML pile because you had to copy and
paste 12 lines of Python code. snip...
I haven't personally formed an opinion on where this sort of thing
should go, but copying and pasting 12 lines of python code is
Rocky Burt wrote:
On Fri, 2006-10-03 at 17:17 -0700, Jeff Shell wrote:
But I beg you not to add to the ZCML pile because you had to copy and
paste 12 lines of Python code. snip...
I haven't personally formed an opinion on where this sort of thing
should go, but copying and pasting 12 lines
21 matches
Mail list logo