[Zope3-Users] Re: Adapters and getters and setters

2006-07-25 Thread Philipp von Weitershausen
Darryl Cousins wrote: > I only recently began using formlib and I have used a schema to describe > the form, and provided an adapter to adapt the object to the schema. > > It seems that formlib uses the adapter to access and set attributes on > the object. That's correct. That way, for example, y

Re: [Zope3-Users] Re: Adapters and getters and setters

2006-07-25 Thread Darryl Cousins
Hi Phillip, Cool. Thanks very much for that! Best regards, Darryl On Tue, 2006-07-25 at 10:16 +0200, Philipp von Weitershausen wrote: > # account for everything in the IBuddy interface > for field in IBuddy: > locals()[field] = property( > lambda self: getattr

[Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Lorenzo Gil Sanchez
Hi, I have a special Folder content. When an instance of this class is created I want to create a catalog and an index in its __init__ method. Something like: class FilterableContainer(BTreeContainer): implements(IFilterableContainer) def __init__(self): super(FilterableContaine

Re: [Zope3-Users] Re: Next steps...

2006-07-25 Thread Chris Withers
Philipp von Weitershausen wrote: I wouldn't say that. It depends on your taste, really. I personally prefer the package-includes approach for development environments; for actual deployments I find having no package-includes at all, but instead putting everything in site.zcml useful, because it's

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Darryl Cousins
Hi Lorenzo, The key reference adapter can only get a key reference **after** the object is added to the database (because it uses _p_oid). The problem could be fixed with a subscriber to IObjectAddedEvent:: def FilterableContainerInitializationHandler(object, event): """Initialize contai

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Darryl Cousins
Hi again, I was a too hasty. Because it is the FieldIndex that is missing the _p_oid attribute, and the fix I offered is for the container. Sorry about that. I need more thinking. Regards, Darryl On Tue, 2006-07-25 at 22:10 +1200, Darryl Cousins wrote: > Hi Lorenzo, > > The key reference adap

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Lorenzo Gil Sanchez
No worries, in fact I actually tried the same aproach and hit the same problem Thanks anyway Lorenzo El mar, 25-07-2006 a las 22:16 +1200, Darryl Cousins escribió: > Hi again, > > I was a too hasty. Because it is the FieldIndex that is missing the > _p_oid attribute, and the fix I offered is fo

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Darryl Cousins
Hi Lorenzo, I got this test to work:: >>> class TestField(Persistent): ... pass >>> class TestCase(Persistent): ... def __init__(self): ... self.fieldkey = KeyReferenceToPersistent(TestField()) >>> t = TestCase() Traceback (most recent call last):

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Darryl Cousins
Hi All, I was thinking about that del(self.field) that I threw in. Wouldn't that remove the object too and therefore the key reference? Apparently not (in the test anyway):: >>> class TestField(Persistent): ... id = u'' ... def __init__(self, id): ... self.id = i

Re: [Zope3-Users] Re: Next steps...

2006-07-25 Thread Philipp von Weitershausen
Chris Withers wrote: > Philipp von Weitershausen wrote: >> I wouldn't say that. It depends on your taste, really. I personally >> prefer the package-includes approach for development environments; for >> actual deployments I find having no package-includes at all, but instead >> putting everything

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Lorenzo Gil Sanchez
Hi Darryl, this is how I ended implementing it: class FilterableContainer(BTreeContainer): implements(IFilterableContainer) def __init__(self, catalog=None): super(FilterableContainer, self).__init__() self.catalog = contained(LocalCatalog(), self, 'catalog') def c

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Darryl Cousins
Hi Lorenzo, Cool. Where is the `contained` imported from? There is some magic there because I couldn't get the test to work when creating the FieldIndex in your createIndexes method without it. Thanks, Darryl On Tue, 2006-07-25 at 13:55 +0200, Lorenzo Gil Sanchez wrote: > Hi Darryl, > > this is

[Zope3-Users] Zope3 winXP service not working

2006-07-25 Thread Eusebius
Hello I installed Zope3 on a Windows XP machine, and configured it as a service. The service is properly registered, and seems to be starting/stopping normally. Nevertheless it's not working: Zope does not listen on 8080 (no python process listening in a netstat output), or any other port.

Re: [Zope3-Users] adding indexes in a __init__ method

2006-07-25 Thread Lorenzo Gil Sanchez
Hi Darryl El mié, 26-07-2006 a las 00:48 +1200, Darryl Cousins escribió: > Hi Lorenzo, > > Cool. Where is the `contained` imported from? There is some magic there > because I couldn't get the test to work when creating the FieldIndex in > your createIndexes method without it. from zope.app.conta