RE: [Zope3-Users] ++skin++Boston bug
Hi Marco your part looks good to me. The use of widget_row in ObjectWidget not... What happen is, the Boston skin uses a table for rendering a label field block. Why this and not CSS. Simply because the left label side has a nother backgrund color. And this isn't possible with CSS. But doesn't matter if this make sense or not. You need to register a different widget_row like tempalte for the ObjectWidget. This tempalte should not use nested tables. This would mean that the second broken td, tr rendering part goes away. Please add also a issue in the bug tracker. Regards Roger Ineichen _ END OF MESSAGE -Original Message- From: Marco Mariani [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 7:20 AM To: [EMAIL PROTECTED] Cc: zope3-users@zope.org Subject: Re: [Zope3-Users] ++skin++Boston bug [EMAIL PROTECTED] wrote: Hi Marco [...] /me guesses this has to do with using the widget_row macro inside another widget_row, thus trying to render trtdtrtd/td/tr/td/tr and the browser closes the fieldset, td and tr when it encounters a tdtr sequence. There is something wrong if you get a widget_row inside a widget_row. What did you register that this nested widget/widget get happen? Here it is: - person/configure.zcml - configure xmlns=http://namespaces.zope.org/zope; i18n_domain=person !-- PERSON -- interface interface=.IPerson type=zope.app.content.interfaces.IContentType/ class class=.Person factory id=person.Person description=Person / require permission=zope.View interface=.IPerson / require permission=zope.ManageContent set_schema=.IPerson / /class !-- FAMILY -- interface interface=.IFamily type=zope.app.content.interfaces.IContentType / class class=.Family factory id=person.Family description=Family / require permission=zope.View interface=.IFamily / require permission=zope.ManageContent set_schema=.IFamily / /class include package=.browser / /configure -- person/__init__.py -- from zope.interface import Interface, implements from zope.schema import TextLine, Object, List, Choice, Field from persistent import Persistent class IPerson(Interface): name = TextLine(title=u'Name') class Person(Persistent): implements(IPerson) name = '' class IFamily(Interface): mother = Object(title=u'Mother', schema=IPerson) father = Object(title=u'Father', schema=IPerson) class Family(Persistent): implements(IFamily) mother = '' father = '' - person/browser/configure.zcml - configure xmlns:zope=http://namespaces.zope.org/zope; xmlns=http://namespaces.zope.org/browser; page class=.forms.FamilyAdd name=AddFamily.html permission=zope.ManageContent for=zope.app.container.interfaces.IAdding / addMenuItem factory=person.Family title=Family description=New Family permission=zope.ManageContent view=AddFamily.html / /configure --- person/browser/forms.py --- from zope.formlib.form import Fields, AddForm, EditForm from person import Person, IPerson, Family, IFamily from zope.app.form.browser import ObjectWidget from zope.app.form import CustomWidgetFactory class FamilyAdd(AddForm): form_fields = Fields(IFamily) form_fields['mother'].custom_widget = CustomWidgetFactory(ObjectWidget, Person) form_fields['father'].custom_widget = CustomWidgetFactory(ObjectWidget, Person) def create(self, data): family = Family() family.mother = data['mother'] family.father = data['father'] return family ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.schema.Object and custom widgets in formlib
Hi, On Tue, May 23, 2006 at 11:21:54AM -0500, Jachin Rupe wrote: On May 23, 2006, at 5:33 AM, Frank Burkhardt wrote: [snip] content class=.entry.StreetAddress allow interface=.interfaces.IABookEntry / /content [snip] Try removing the content-statement for the Object()s. Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Reference to a COM object (or other external resource) in a Zope object
Hi, I am creating a kind of Zope proxy to a 3rd party COM object (I'm accessing it using Pywin32 facilities). I have to store a reference to this object somewhere in my Zope object. But, for obvious reasons, this COM object cannot be serialized so I cannot put it in any attribute of my Zope object. On the other side, initialisation of the object on each request is too timecost-consuming. From what I read on the web and this list, _v_ fields won't solve my problem, because the _v_ field may be reset in any time, when (de)serialization occurs. So I have a question, which may be generalized: how to properly store/cache a handle or a reference to some OS resource, if I cannot create/alloc and destroy/dealloc it on every request? I have read somewhere that possibly I can use module variables for this purpose. Is it the 'right' way? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Reference to a COM object (or other external resource) in a Zope object
[EMAIL PROTECTED] wrote: I am creating a kind of Zope proxy to a 3rd party COM object (I'm accessing it using Pywin32 facilities). I have to store a reference to this object somewhere in my Zope object. But, for obvious reasons, this COM object cannot be serialized so I cannot put it in any attribute of my Zope object. On the other side, initialisation of the object on each request is too timecost-consuming. With my still somewhat limited Zope knowledge, I would say it sounds like you should have a look at utilities. regards, Achim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Calling PageTemplate in Content object
I'm trying to call a page template in a content object, but nothing seems to happen. No exceptions, no output, and no errors. I figure I'm missing something. Anyone have ideas? ... from zope.pagetemplate.pagetemplatefile import PageTemplateFile class OrderView: def city(self): return 'Fort Worth' class ProcessStep(StepFactory): implements(IProcessStep) orderform = PageTemplateFile('orderform.pt') def message(self,request): return self.orderform(self,order=OrderView()) ... orderform.pt ... html body My City Is: div tal:replace=order/city/ /body /html ... step.message(request) *** Note how nothing is returned - no exceptions and no output. Thanks in advance. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling PageTemplate in Content object
On Wed, May 24, 2006 at 11:31:29AM -0500, David Johnson wrote: from zope.pagetemplate.pagetemplatefile import PageTemplateFile class OrderView: def city(self): return 'Fort Worth' class ProcessStep(StepFactory): implements(IProcessStep) orderform = PageTemplateFile('orderform.pt') maybe this attribute ought to be called template instead of orderform ? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Non-owning references in Zope3
Tom Dossis wrote: [EMAIL PROTECTED] wrote: Hi, I am relatively new to Zope3. I could not find anywhere an example, what is the 'right way' to make non-owning reference to another object in Zope? Every piece of zope3 docs is full of examples of containers, this makes a good tree like structure. But how to refer from one object to another in right way? Can/should I do that with Object field? One offering is zc.extrinsicreference ... http://svn.zope.org/zc.extrinsicreference/trunk/src/zc/extrinsicreference/extrinsicreference.txt I'm not aware of any zope.schema / FieldProperty stuff to do this; it would be pretty useful though. Thanks! I have also found a references library in 'schooltool' project. It seems to be similar to RDF and adapts any Annotatable object. But I'm looking for something more straightforward - both approaches (extrinct and schooltool) seem to be too complex and not pythonic... ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 07:00, Martijn Faassen wrote: Ron Bickers wrote: I was trying to implement the new annotations factory in zope/annotation/README.txt but I'm getting a ForbiddenAttribute __annotations__ error when I try to view an editform for the annotations. Before, I had configured a trusted adapter, but since (I think) an adapter directive is not needed for this, I don't know how to make it trusted or otherwise fix the problem. Any ideas? These annotations still get registered using the adapter statement: adapter factory=.my.annotationfactory trusted=true / I tried this, but I'm still having trouble. Perhaps I'm missing something simple. I have the following: An IItem interface and a class Item implementation that's attribute annotatable. The annotation interface and class are as follows: class IItemMiscInfo(Interface): inStock = Bool( title=uIn Stock, description=uIs item in stock?, default=True) class ItemMiscInfo(Persistent): implements(IItemMiscInfo) adapts(IItem) def __init__(self): self.inStock = True What am I supposed to use in the adapter directive as the factory? If I put .item.ItemMiscInfo, I get TypeError: Missing 'provides' attribute when starting Zope. If I add provides=.interfaces.IItemMiscInfo, I get the following error when trying to access the editform: File /usr/lib/zope-3.3.0_beta1/lib/python/zope/security/adapter.py, line 84, in __call__ adapter = self.factory(*args) TypeError: __init__() takes exactly 1 argument (2 given) The README says to do this: zope.component.provideAdapter(zope.annotation.factory(Item)) I can do that in a debug session and it works as expected, I just can't figure out the rest. What am I missing? -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Non-owning references in Zope3
On May 24, 2006, at 4:27 PM, Alek Kowalczyk wrote: Tom Dossis wrote: [EMAIL PROTECTED] wrote: Hi, I am relatively new to Zope3. I could not find anywhere an example, what is the 'right way' to make non-owning reference to another object in Zope? Every piece of zope3 docs is full of examples of containers, this makes a good tree like structure. But how to refer from one object to another in right way? Can/ should I do that with Object field? One offering is zc.extrinsicreference ... http://svn.zope.org/ zc.extrinsicreference/trunk/src/zc/extrinsicreference/ extrinsicreference.txt I'm not aware of any zope.schema / FieldProperty stuff to do this; it would be pretty useful though. Thanks! I have also found a references library in 'schooltool' project. It seems to be similar to RDF and adapts any Annotatable object. But I'm looking for something more straightforward - both approaches (extrinct and schooltool) seem to be too complex and not pythonic... It sounds like you just want to make python references? That works. given A and B, two objects whose classes inherit from persistent.Persistent, A.foo = B and B.bar = A will work as you expect. Haven't seen clear requirements for this from you, but maybe I missed them. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling PageTemplate in Content object
David Johnson wrote: I'm trying to call a page template in a content object, but nothing seems to happen. No exceptions, no output, and no errors. I figure I'm missing something. Anyone have ideas? ... from zope.pagetemplate.pagetemplatefile import PageTemplateFile class OrderView: def city(self): return 'Fort Worth' class ProcessStep(StepFactory): implements(IProcessStep) orderform = PageTemplateFile('orderform.pt') def message(self,request): return self.orderform(self,order=OrderView()) ... orderform.pt ... html body My City Is: div tal:replace=order/city/ /body /html ... step.message(request) *** Note how nothing is returned - no exceptions and no output. Have a look at zope/pagetemplate/readme.txt - it shows (one way) how to inject 'order' into the tal 'namespace'., e.g. class MyPageTemplateFile(PageTemplateFile): ... def pt_getContext(self, args=(), options={}, **kw): ... rval = PageTemplateFile.pt_getContext(self, args=args) ... options.update(rval) ... return options orderform=MyPageTemplateFile('orderform.pt') orderform(order=OrderView()) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 16:42, Tom Dossis wrote: File /usr/lib/zope-3.3.0_beta1/lib/python/zope/security/adapter.py, line 84, in __call__ adapter = self.factory(*args) TypeError: __init__() takes exactly 1 argument (2 given) I haven't been following this thread, however from the error message it appears your adapter is missing the context (adaptee)... def __init__(self, context): # context is the IItem object to be adapted. The README says the following: Note that the annotation implementation does not expect any arguments to its `__init__`. Otherwise it's basically an adapter. And the example is defined as follows: class Bar(Persistent): interface.implements(IBar) component.adapts(IFoo) def __init__(self): self.a = 1 self.b = 2 That's why I didn't think the adapter directive would do the right thing, but all of this (Zope 3) is pretty new to me, so what do I know. -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
Ron Bickers wrote: On Wed May 24 2006 16:42, Tom Dossis wrote: I haven't been following this thread, however from the error message it appears your adapter is missing the context (adaptee)... def __init__(self, context): # context is the IItem object to be adapted. The README says the following: Note that the annotation implementation does not expect any arguments to its `__init__`. Otherwise it's basically an adapter. And the example is defined as follows: class Bar(Persistent): interface.implements(IBar) component.adapts(IFoo) def __init__(self): self.a = 1 self.b = 2 That's why I didn't think the adapter directive would do the right thing, but all of this (Zope 3) is pretty new to me, so what do I know. Mmm, I hadn't seen this before. from zope.annotation import factory component.provideAdapter(factory(Bar)) Did you try something like... ? MyFactory=factory(ItemMiscInfo) And corresponding zcml.. adapter factory=.mymodule.MyFactory ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 17:00, Tom Dossis wrote: Did you try something like... ? MyFactory=factory(ItemMiscInfo) And corresponding zcml.. adapter factory=.mymodule.MyFactory It's like magic! Everything is working perfectly, now. Thank you! -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Calling PageTemplate in Content object
Hi Tom [...] ... orderform.pt ... html body My City Is: div tal:replace=order/city/ /body /html ... step.message(request) *** Note how nothing is returned - no exceptions and no output. Have a look at zope/pagetemplate/readme.txt - it shows (one way) how to inject 'order' into the tal 'namespace'., e.g. class MyPageTemplateFile(PageTemplateFile): ... def pt_getContext(self, args=(), options={}, **kw): ... rval = PageTemplateFile.pt_getContext(self, args=args) ... options.update(rval) ... return options orderform=MyPageTemplateFile('orderform.pt') orderform(order=OrderView()) That's correct but perhaps a little to much. Probably you are looking for something like this: div tal:replace=options/order/city/ The default namespace for *custom* keyword agruments is called *options* in a page templates. Regards Roger Ineichen _ END OF MESSAGE ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling PageTemplate in Content object
[EMAIL PROTECTED] wrote: * The default namespace for *custom* keyword agruments is called *options* in a page templates. * That's a useful summary I didn't pickup. Thank you ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Calling PageTemplate in Content object
I still wonder why calling PageTemplate does not always render output or not give errors. That's the strangest part. At least with errors the problem would be diagnosible. I will try the options/ format to see if I have any success. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling PageTemplate in Content object
David Johnson wrote: I still wonder why calling PageTemplate does not always render output or not give errors. That's the strangest part. At least with errors the problem would be diagnosible. Sounds like the error (exception) is being swallowed up somewhere - or perhaps the code isn't running as you expect. I got an error when I tried it directly in the zopectl debug interpreter (and likewise - output when it ran properly). I will try the options/ format to see if I have any success. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Create complex object
Hi, I have the this interface class IWorkspace(Interface): title = TextLine( title=uTitle, description=uThe title, default=uproCoders Workspace, required=True) projects = Container(title=uProjects, description=uxxx) articles = Container(title=uArticles, description=uxxx) with the following implementation class Workspace(Persistent): implements(IWorkspace) title=u'proCoders workspace' projects=None articles=None To set projects and articles I have registered an event subscriber. The handling functions is defined like this: def onObjectCreated(parent,event): if IWorkspace.providedBy(event.object): workspace=IWorkspace(event.object) workspace.projects=ProjectFolder() workspace.articles=ArticleFolder() I registered an add form with the following zcml statement: browser:addform label=Add proCoders Article name=AddArticle.html schema=proCoders.interfaces.IArticle content_factory=proCoders.Article.Article permission=zope.ManageContent fields=title / I added the fields=title attribute, because I get the following error, if I try to create an instance of Workspace: ComponentLookupError: ((zope.schema._bootstrapfields.Container object ... It's clear to me, that the widgets for projects and articles can not be created, but I tought that if I set fields=title I will not show them!? How do I solve this problem? Should I implement a mix-in class for the add view? regards, Achim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users