Re: [Zope3-Users] Pagination
You have http://svn.zope.org/z3c.batching/trunk/src/z3c/batching/README.txt?rev=72270&view=auto z3c.batching and http://svn.zope.org/zc.table/trunk/src/zc/table/README.txt?rev=66648&view=auto zc.table that I know of. > If I have a Container with a lot of items, How can I do pagination? > Does Zope3 provide any lib for this > Where can I get some documentation? > > > Thanks a lot -- View this message in context: http://www.nabble.com/Pagination-tf4602017.html#a13140701 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Virtualenv, zopeproject, MinGW and Windows
I'm reposting this as my original post was buried in another thread. I've managed to get the zopeproject to work correctly on my Windows box thanks to the easy to follow instructions on the PyPI page for it. Next I tried to do a "python setup.py install" which, I was informed, is generally a bad idea to do and was suggested to use "virtualenv" to keep my global python nice and clean. So I easy_installed virtualenv and making that work was a simple task. But once I'm inside my virtual environment, I can no longer get the zopeproject to compile the C extensions. H:\>Python24\Scripts\virtualenv.exe zopetest New python executable in zopetest\Scripts\python.exe Installing setuptools...done. H:\>cd zopetest H:\zopetest>Scripts\easy_install.exe zopeproject Searching for zopeproject Reading http://pypi.python.org/simple/zopeproject/ Best match: zopeproject 0.4 Downloading http://pypi.python.org/packages/2.4/z/zopeproject/zopeproject-0.4-py 2.4.egg#md5=3d5aa6290e3664698086f1279229e733 Processing zopeproject-0.4-py2.4.egg creating h:\zopetest\lib\site-packages\zopeproject-0.4-py2.4.egg Extracting zopeproject-0.4-py2.4.egg to h:\zopetest\lib\site-packages Adding zopeproject 0.4 to easy-install.pth file Installing zopeproject-script.py script to H:\zopetest\Scripts Installing zopeproject.exe script to H:\zopetest\Scripts Installed h:\zopetest\lib\site-packages\zopeproject-0.4-py2.4.egg Processing dependencies for zopeproject Finished processing dependencies for zopeproject H:\zopetest>Scripts\zopeproject.exe myzope Enter user (Name of an initial administrator user): admin Enter passwd (Password for the initial administrator user): admin Enter eggs_dir (Location where zc.buildout will look for and place packages) ['C :\\Documents and Settings\\mats\\buildout-eggs']: Creating directory .\myzope Downloading zc.buildout... Invoking zc.buildout... zip_safe flag not set; analyzing archive contents... error: Setup script exited with error: command 'gcc' failed with exit status 1 An error occured when trying to install zope.i18nmessageid 3.4.3.Look above this message for any errors thatwere output by easy_install. An error occured when trying to install zope.i18nmessageid 3.4.3.Look above this message for any errors thatwere output by easy_install. While: Installing app. Getting distribution for 'zope.i18nmessageid'. Error: Couldn't install: zope.i18nmessageid 3.4.3 Any help appreciated, Mats -- View this message in context: http://www.nabble.com/Virtualenv%2C-zopeproject%2C-MinGW-and-Windows-tf4524562.html#a12908760 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.session and eggs?
> Yes. Somebody created a new zope.app.session egg that doesn't contain a > CHANGES.txt. We'll try and upload a new one. Thanks for catching this. Looks like zope.app.session is fixed, thanks. Now I get an error with zope.event. Installed h:\python24\lib\site-packages\zope.event-3.4.0-py2.4.egg Searching for zope.minmax Reading http://pypi.python.org/simple/zope.minmax/ Couldn't find index page for 'zope.minmax' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ No local packages or download links found for zope.minmax error: Could not find suitable distribution for Requirement.parse('zope.minmax') -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12888485 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.session and eggs?
PS, this only happens in the virtual instance, it compiles with MinGW just fine on a pure zopeproject with global python. Mats Nordgren wrote: > >> I think that he's saying that it's better to have a virtual python >> enviroment instead of use the global python. In other thread in the list >> you >> will find something like this: > >> $ python virtualenv.py env >> ... >> $ cd env >> $ bin/easy_install zopeproject >> ... >> $ bin/zopeproject HelloWorld > > That looks like a nice solution. Wasn't aware of this before. Now when I > run the zopeproject I get the following error. Not sure it is related to > virtualenv.py or if it is something that is changed in the PyPI. > > > src\zope\i18nmessageid\_zope_i18nmessageid_message.c:125: warning: > 'Message_trav > erse' defined but not used > error: Setup script exited with error: command 'gcc' failed with exit > status 1 > An error occured when trying to install zope.i18nmessageid 3.4.2.Look > above this > message for any errors thatwere output by easy_install. > An error occured when trying to install zope.i18nmessageid 3.4.2.Look > above this > message for any errors thatwere output by easy_install. > While: > Installing app. > Getting distribution for 'zope.i18nmessageid'. > Error: Couldn't install: zope.i18nmessageid 3.4.2 > > Thanks, > > Mats > -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12888094 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.session and eggs?
> I think that he's saying that it's better to have a virtual python > enviroment instead of use the global python. In other thread in the list > you > will find something like this: > $ python virtualenv.py env > ... > $ cd env > $ bin/easy_install zopeproject > ... > $ bin/zopeproject HelloWorld That looks like a nice solution. Wasn't aware of this before. Now when I run the zopeproject I get the following error. Not sure it is related to virtualenv.py or if it is something that is changed in the PyPI. src\zope\i18nmessageid\_zope_i18nmessageid_message.c:125: warning: 'Message_trav erse' defined but not used error: Setup script exited with error: command 'gcc' failed with exit status 1 An error occured when trying to install zope.i18nmessageid 3.4.2.Look above this message for any errors thatwere output by easy_install. An error occured when trying to install zope.i18nmessageid 3.4.2.Look above this message for any errors thatwere output by easy_install. While: Installing app. Getting distribution for 'zope.i18nmessageid'. Error: Couldn't install: zope.i18nmessageid 3.4.2 Thanks, Mats -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12887987 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.session and eggs?
> I suggest creating individual, quarantined sandboxes using zopeproject: > http://cheeseshop.python.org/pypi/zopeproject Can you tell me how I can get the eggs in the sandbox into the python path so my auto-completion will work while developing for Zope? When I do a "python setup.py install" the eggs are added to the easy-install.pth this does not happen in the sandbox. I guess this can be done manually but creating pth files for each package in the sandbox seems like a hassle and hopefully there is a better way. Thanks -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12885689 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.session and eggs?
> I suggest creating individual, quarantined sandboxes using zopeproject: > http://cheeseshop.python.org/pypi/zopeproject Can you tell me how I can get the eggs in the sandbox into the python path so my auto-completion will work while developing for Zope? When I do a "python setup.py install" the eggs are added to the easy-install.pth this does not happen in the sandbox. I guess this can be done manually but creating pth files for each package in the sandbox seems like a hassle and hopefully there is a better way. Thanks -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12885645 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] zope.app.session and eggs?
I finally got the courage to try the eggs install on Windows after reading the documentation on zopeproject. It worked great and I have my brand new project working. Now here is the problem. I'm assuming a "python setup.py install" will download all the parts and install it into my python site-packages directory as that seems to be what it is doing. But I get an error when i get to the zope.app.session package. Here is the trace. Now I'm not sure why it is trying to get the 3.4 version as the zopeproject downloaded the 3.5dev. Can someone shed some light on this? Searching for zope.app.session Reading http://pypi.python.org/simple/zope.app.session/ Reading http://svn.zope.org/zope.app.session Best match: zope.app.session 3.4.0 Downloading http://pypi.python.org/packages/source/z/zope.app.session/zope.app.s ession-3.4.0.zip#md5=c3d63fd6917049ed3556d32972441031 Processing zope.app.session-3.4.0.zip Running zope.app.session-3.4.0\setup.py -q bdist_egg --dist-dir c:\docume~1\mats \locals~1\temp\easy_install-3z0srr\zope.app.session-3.4.0\egg-dist-tmp-b02rfo error: c:\docume~1\mats\locals~1\temp\easy_install-3z0srr\zope.app.session-3.4.0 \CHANGES.txt: No such file or directory -- View this message in context: http://www.nabble.com/zope.app.session-and-eggs--tf4517094.html#a12884814 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] z3c.form and subforms in an AddForm?
> Just access your sub-form. In the new "Address Book" demo of > z3c.formdemo, > the sub-forms are responsible of creating sub-objects, so there you simply > can ask for the content like this: form.subForm.getContent(). In edit > forms > you do not have to do anything, because you are modifying thos sub- > objects. I know I asked for a subform demo... but wow, this is way, way, way more than had even hoped for, thanks a million Stephan, this will be of great help. Mats ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] z3c.form and subforms in an AddForm?
Stephan, Thanks again for you help. I'm still having the ErrorViewSnippet problem. I've gone over and over the message example in formdemo and can't see anything different in my setup from the demo. The demo works fine but mine throws the ErrorViewSnippet error when I submit an AddForm with missing input. EditForm works correct though. Here is the full traceback. I'll also include the browser files at the end. Traceback (most recent call last): Module zope.publisher.publish, line 133, in publish result = publication.callObject(request, obj) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 108, in mapply return debug_call(obj, args) - __traceback_info__: Module zope.publisher.publish, line 114, in debug_call return obj(*args) Module z3c.formui.layout, line 40, in __call__ return layout(self) Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), Module zope.pagetemplate.pagetemplate, line 117, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() Module zope.tal.talinterpreter, line 271, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 534, in do_optTag_tal self.no_tag(stuff[-2], stuff[-1]) Module zope.tal.talinterpreter, line 516, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal structure = self.engine.evaluateStructure(expr) Module zope.tales.tales, line 696, in evaluate return expression(self) - D:\Mats\Zope\lib\python\metrod\app\skin\template.pt - Line 22, Column 2 - Expression: - Names: {'args': (), 'context': , 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': http://localhost:50080/++skin++MetroDSkin/@@addRestaurant.html>, 'template': , 'usage': , 'view': , 'views': } Module zope.contentprovider.tales, line 74, in __call__ return provider.render() Module z3c.pagelet.provider, line 43, in render return self.__parent__.render() Module z3c.form.form, line 186, in render return super(AddForm, self).render() Module z3c.form.form, line 95, in render return template(self) Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), Module zope.pagetemplate.pagetemplate, line 117, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() Module zope.tal.talinterpreter, line 271, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 891, in do_useMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 957, in do_defineSlot self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 861, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 536, in do_optTag_tal self.do_optTag(stuff) Module zope.tal.talinterpreter, line 521, in do_optTag return self.no_tag(start, program) Module zope.tal.talinterpreter, line 516, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 855, in do_condition self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 855, in do_condition self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 824, in do_loop_tal self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 534, in do_optTag_tal self.no_tag(stuff[-2], stuff[-1]) Module zope.tal.talinterpreter, line 516, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 623, in do_insertText_tal text = self.engine.evaluateText(stuff[0]) Module zope.tales.tales, line 704, in evaluateText text = self.evaluate(expr) Module zope.tales.tales, line 696, in evaluate return exp
RE: [Zope3-Users] z3c.form and subforms in an AddForm?
Thanks Stephan, I have now got the sub form to render in browser. Much appreciated. A few more questions though. In the create method, the data is only the parent data. The self.widgets.extract() returns only parent data. The only place I see the sub form data is in self.request.form. What is the best way to extract the data and create your object? Perhaps unrelated but I had this working before. I'm using formui and I'm getting a "TraversalError: (, 'widget')". I tried to trim out all the sub-form stuff I've messed around with and replaced a simple object with two textlines one of which is required. This happens when I'm submitting the form without an entry in required field. With data it works just fine and adds the object. The addform is using the macro:form from formui. Any ideas as to where this comes from and how I can fix it? Thanks, Mats Nordgren > -Original Message- > From: Stephan Richter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 19, 2007 2:49 PM > To: zope3-users@zope.org > Cc: gnosis > Subject: Re: [Zope3-Users] z3c.form and subforms in an AddForm? > > On Friday 15 June 2007 13:52, gnosis wrote: > > browser/restaurant.py > > > > class RestaurantAddForm(AddFormLayoutSupport, form.AddForm): > > """Add form""" > ... > > You do not need the layout support here, since this view does not render > as a > standalone Web page. > > ... > > def update(self): > > self.address = AddressAddForm(self.context.address, > self.request) > > ## < Problem area > > self.address.update() > > super(RestaurantAddForm, self).update() > ... > > Simply pass in self.context. > > > browser/address.py > ... > Looks good. > > > > browser/configure.zcml > ... > > > >> name="addAddress.html" > > for="metrod.restaurant.interfaces.IAddress" > > class=".address.AddressAddForm" > > layer="metrod.app.layer.IMetroDBrowserLayer" > > permission="zope.Public" /> > ... > > This directive is not needed, since you never render it as a standalone > Web > page. You already instantiate the view within the person view's update() > method. > > BTW, you forgot the most interesting part. The templates. In the person > view > template you have to somewhere do this or something similar: > > > > Regards, > Stephan > -- > Stephan Richter > CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) > Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] AW: AW: z3c.form and subforms in an AddForm?
Duh That fixed it so there are no errors when rendering, but still no subform. I get the name and description field with an apply button. Thanks Stephen, Mats Nordgren Zope retard of the week > -Original Message- > From: Stephan Richter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 19, 2007 10:56 AM > To: zope3-users@zope.org > Cc: Mats Nordgren; [EMAIL PROTECTED] > Subject: Re: [Zope3-Users] AW: AW: z3c.form and subforms in an AddForm? > > On Tuesday 19 June 2007 13:39, Mats Nordgren wrote: > > def updateWidgets(self): > > self.widgets = component.getMultiAdapter(( > > self, self.request, self.getContent()), IWidgets) > > self.widgets.ingoreContext = True > > self.widgets.update() > > You misspelled "ignoreContext". :-) > > Regards, > Stephan > -- > Stephan Richter > CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) > Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] AW: AW: z3c.form and subforms in an AddForm?
Roger, > You missed in the AddressAddForm ``self.widgets.ignoreContext = True`` I see that I missed that statement, it was late on a sleepless night, but I couldn't get this out of my head. In any case, I've changed my code to match the example you gave in the repository. I also have the templates defined in the view instead of through zcml as you have in the tests. browser/restaurant.py class RestaurantAddForm(form.EditForm): """Add form""" fields = field.Fields(IRestaurant).select('name', 'description') template = viewpagetemplatefile.ViewPageTemplateFile('restaurant.pt') prefix = u'restaurant' def updateWidgets(self): self.widgets = component.getMultiAdapter(( self, self.request, self.getContent()), IWidgets) self.widgets.ignoreContext = True self.widgets.update() def update(self): self.address = AddressAddForm(None, self.request) self.address.update() super(RestaurantAddForm, self).update() browser/address.py class AddressAddForm(form.EditForm): fields = field.Fields(IAddress) template = viewpagetemplatefile.ViewPageTemplateFile('address.pt') prefix = u'address' def updateWidgets(self): self.widgets = component.getMultiAdapter(( self, self.request, self.getContent()), IWidgets) self.widgets.ingoreContext = True self.widgets.update() browser/configure.zcml I believe those matches your example exactly but I still get the adaption error when the form should be displayed. Traceback (most recent call last): Module zope.publisher.publish, line 133, in publish result = publication.callObject(request, obj) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 108, in mapply return debug_call(obj, args) - __traceback_info__: Module zope.publisher.publish, line 114, in debug_call return obj(*args) Module z3c.form.form, line 139, in __call__ self.update() Module metrod.restaurant.browser.restaurant, line 31, in update self.address.update() Module z3c.form.form, line 134, in update super(Form, self).update() Module z3c.form.form, line 83, in update self.updateWidgets() Module metrod.restaurant.browser.address, line 21, in updateWidgets self.widgets.update() Module z3c.form.field, line 245, in update widget.update() Module z3c.form.widget, line 96, in update value = zope.component.getMultiAdapter( Module z3c.form.datamanager, line 48, in get context = self.field.interface(context) TypeError: ('Could not adapt', None, ) Am I forgetting some configuration on my forms? I have not configured anything for AddressAddForm could that be the issue? > And take more care about the super classes. you are suing a EditForm > as base. Same in the RestaurantAddForm. Not sure I'm understanding this, your example used EditForm without any thought on superclasses. Again thanks for all your time and effort, I really appreciate this. Mats Nordgren PS. Would there be a chance you could include the car/owner example in the z3c.formdemo package? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] AW: AW: z3c.form and subforms in an AddForm?
Roger, Thanks again for trying to help me out. I think I'm having some registration issues that I'm not sure what to do with. Using the example you posted I receive the following error: Traceback (most recent call last): Module zope.publisher.publish, line 133, in publish result = publication.callObject(request, obj) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 108, in mapply return debug_call(obj, args) - __traceback_info__: Module zope.publisher.publish, line 114, in debug_call return obj(*args) Module z3c.formui.layout, line 34, in __call__ self.update() Module metrod.restaurant.browser.restaurant, line 33, in update self.address.update() Module z3c.form.form, line 134, in update super(Form, self).update() Module z3c.form.form, line 83, in update self.updateWidgets() Module metrod.restaurant.browser.address, line 25, in updateWidgets self.widgets.update() Module z3c.form.field, line 245, in update widget.update() Module z3c.form.widget, line 96, in update value = zope.component.getMultiAdapter( Module z3c.form.datamanager, line 48, in get context = self.field.interface(context) TypeError: ('Could not adapt', None, ) My forms look like this: browser/restaurant.py class RestaurantAddForm(AddFormLayoutSupport, form.EditForm): """Add form""" template = None layout = None contentName = None label = u'Add Restaurant' prefix = u'restaurant' fields = field.Fields(IRestaurant) def updateWidgets(self): self.widgets = component.getMultiAdapter(( self, self.request, self.getContent()), IWidgets) self.widgets.ignoreContext = True self.widgets.update() def update(self): self.address = AddressAddForm(None, self.request) self.address.update() super(RestaurantAddForm, self).update() browser/address.py class AddressAddForm(AddFormLayoutSupport, form.EditForm): template = None layout = None contentName = None label = u'Address' fields = field.Fields(IAddress) prefix = u'address' def updateWidgets(self): self.widgets = component.getMultiAdapter(( self, self.request, self.getContent()), IWidgets) self.widgets.ignoreRequest = True self.widgets.update() I have them registered like this: Thanks again for all your time and help, Mats Nordgren > Hi Mats > >> Betreff: Re: [Zope3-Users] AW: z3c.form and subforms in an AddForm? >> >> >> Roger, >> >> Thanks for your reply. I'm still having problems getting >> this to work. >> >> I'm not sure I am supposed to use a BaseForm, Form, AddForm, >> or what, for the sub-item. I'm not sure how to register it >> in zcml to not get adaption errors when I run it. >> >> Would there be any chance to have the example with the "car" >> and "owner" in the Sub-Form doc test included in the formdemo >> package. I'd like to see that included with "Class I" and >> "Class II" for both AddForm and EditForm since it is such a >> common use case. >> >> Perhaps I'm just dense, but I still have problems converting >> doc tests into an actual working zope instance. The formdemo >> package was a god send to get a simple addform working since >> I had no idea you needed to use the IFormLayer. Using the >> demo that was no longer a problem. >> >> Again thanks for all your help. > > Ok, the context less demo is in revision 76745. > > svn://svn.zope.org/repos/main/z3c.form/trunk/src/z3c/form/subform.txt > > line 489 - 608 > > Regards > Roger Ineichen -- View this message in context: http://www.nabble.com/z3c.form-and-subforms-in-an-AddForm--tf3929436.html#a11171577 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] AW: z3c.form and subforms in an AddForm?
Roger, Thanks for your reply. I'm still having problems getting this to work. I'm not sure I am supposed to use a BaseForm, Form, AddForm, or what, for the sub-item. I'm not sure how to register it in zcml to not get adaption errors when I run it. Would there be any chance to have the example with the "car" and "owner" in the Sub-Form doc test included in the formdemo package. I'd like to see that included with "Class I" and "Class II" for both AddForm and EditForm since it is such a common use case. Perhaps I'm just dense, but I still have problems converting doc tests into an actual working zope instance. The formdemo package was a god send to get a simple addform working since I had no idea you needed to use the IFormLayer. Using the demo that was no longer a problem. Again thanks for all your help. Mats Nordgren > Hi > >> Betreff: [Zope3-Users] z3c.form and subforms in an AddForm? >> >> >> I've been trying out the new z3c form package and like what I >> see. I am having problems getting a subform in an AddForm >> though. The subform.txt covers EditForms where you have a >> context object to work on, in an AddForm the context is the >> underlying IContainer. >> >> Here is what I have, using formdemo examples as the basis. >> Any help on getting this to work is greatly appreciated. >> >> IRestaurant with address attribute using schema.Object >> holding an IAddress. >> >> browser/restaurant.py >> >> class RestaurantAddForm(AddFormLayoutSupport, form.AddForm): >> """Add form""" >> >> template = None >> layout = None >> contentName = None >> label = u'Add Restaurant' >> >> fields = field.Fields(IRestaurant).omit('address') >> >> def update(self): >> self.address = AddressAddForm(self.context.address, >> self.request) ## >> < Problem area >> self.address.update() >> super(RestaurantAddForm, self).update() > > You can add a custom setupWidgets method in the sub form which > disables the context adaption. > > Stephan and I duscussed this during development, I think we > should add the hook into the form. He thinks not. But I guess > we have to discuss this once again. > > Here is the method for context less forms: > > def updateWidgets(self): > self.widgets = zope.component.getMultiAdapter( > (self, self.request, self.getContent()), interfaces.IWidgets) > self.widgets.ignoreContext = True > self.widgets.ignoreReadonly = True > self.widgets.update() > > >> def create(self, data): >> r = Restaurant() >> r.name = data['name'] >> r.description = data['description'] >> r.address = data['address'] >> return r >> >> def add(self, object): >> self._name = object.name >> self.context[self._name] = object >> return object >> >> def nextURL(self): >> return absoluteURL(self.context[self._name], self.request) > > > Regards > Roger Ineichen -- View this message in context: http://www.nabble.com/z3c.form-and-subforms-in-an-AddForm--tf3929436.html#a11167050 Sent from the Zope3 - users mailing list archive at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Zope 3.3.0 creating DTML page TypeError: readline()takes exactly 1 argument (2 given)
I think this has been fixed in 3.3.1. It was a problem with python 2.4.4 and Zope versions earlier than 3.3.1. See http://www.zope.org/Collectors/Zope3-dev/535 Easiest is just to update to latest release. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Christensen Sent: Friday, March 09, 2007 6:07 PM To: zope3-users@zope.org Subject: [Zope3-Users] Zope 3.3.0 creating DTML page TypeError: readline()takes exactly 1 argument (2 given) zope3-users: I am a newbie running Zope 3.3.0 on FreeBSD 6.2. I'm trying to create a "hello, world!" home page. When I browse to my Zope instance, log in using the administrator account, drill down to [Top] -> ++etc++site -> default, choose DTML Page, enter the magic words in the text area, and click Add, my browser indicates error 500 and z3.log says: 2007-03-09T17:55:06 ERROR SiteError http://p3800.holgerdanske.com:80 80 Traceback (most recent call last): File "/usr/local/www/Zope3/lib/python/zope/publisher/publish.py", line 126, in publish request.processInputs() File "/usr/local/www/Zope3/lib/python/zope/publisher/browser.py", line 263, in processInputs fs = FieldStorage(fp=fp, environ=self._environ, keep_blank_value s=1) File "/usr/local/lib/python2.4/cgi.py", line 530, in __init__ self.read_multi(environ, keep_blank_values, strict_parsing) File "/usr/local/lib/python2.4/cgi.py", line 650, in read_multi environ, keep_blank_values, strict_parsing) File "/usr/local/lib/python2.4/cgi.py", line 532, in __init__ self.read_single() File "/usr/local/lib/python2.4/cgi.py", line 665, in read_single self.read_lines() File "/usr/local/lib/python2.4/cgi.py", line 687, in read_lines self.read_lines_to_outerboundary() File "/usr/local/lib/python2.4/cgi.py", line 715, in read_lines_to _outerboundary line = self.fp.readline(1<<16) TypeError: readline() takes exactly 1 argument (2 given) I'm just fumbling around with Zope, and don't know if I'm using the software wrong or if this is a bug in Zope (or elsewhere). I guess the meta-question is: "what's the best way to learn Zope?". STFW, I can't seem to find any Zope 3 tutorials, and the most recent online edition of "The Zope Book" seems to cover version 2.6. Should I attempt to read/follow that version of the book using Zope 3 and "discover" the differences, or would I be better off installing Zope 2.6? TIA, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Webdav source server
There is a webdav entry in svn. Not sure this is what you are looking for. http://svn.zope.org/zope.webdav/trunk/src/zope/webdav/#dirlist From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luiz Fernando Bernardes Ribeiro Sent: Saturday, September 30, 2006 9:15 AM To: zope3-users@zope.org Subject: [Zope3-Users] Webdav source server Hello all, Is webdav source server available in zope 3? Thanks in advance, -- Luiz Fernando B. Ribeiro ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] assigning roles to principals onAuthenticatedPrincipalCreated event
As I understand a principal is created and destroyed with each request. This would make your application set the permission at each request which might not be exactly what you had in mind. I use a group folder from pau and set the group with a subscriber when the site object is created. def SiteCreatedHandler(context, event): ... sm = LocalSiteManager(context) context.setSiteManager(sm) setSite(context) default = sm['default'] pau = PluggableAuthentication(prefix='pau.') default['pau'] = pau sm.registerUtility(pau, provided=IAuthentication) groups = GroupFolder(prefix='groups.') pau['groups'] = groups sm.registerUtility(groups, provided=IAuthenticatorPlugin, name='groups') members = GroupInformation('members') groups['members'] = members sm.registerUtility(members, provided=IGroupInformation, name='members') principals = PrincipalFolder(prefix='principals.') pau['principals'] = principals sm.registerUtility(principals, provided=IAuthenticatorPlugin, \ name='principals') principal_roles = IPrincipalRoleManager(context) principal_roles.assignRoleToPrincipal(u'metrod.Member', \ 'pau.groups.members') Then when a new member sign up I add them to the group i.e. 'member'. I do this in the createAndAdd method of formlibs AddForm. def createAndAdd(self, data): name = data['name'] password = data['password'] pau = getUtility(IAuthentication, context=self.context) principals = getUtility(IAuthenticatorPlugin, name='principals', \ context=self.context) principal = InternalPrincipal(name, password, name) principals[name] = principal groups = getUtility(IGroupInformation, name='members', \ context=self.context) groups.principals += (pau.prefix + principals.prefix + name, ) return self.request.response.redirect('.') Not sure this is the best way to do it but it works for me. One thing I did see in your code though is: prm.assignRoleToPrincipal('isi.member', event.principal) which should be: prm.assignRoleToPrincipal('isi.member', event.principal.id) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hassan Alirezaei Sent: Thursday, September 21, 2006 7:55 AM To: zope3-users@zope.org Subject: [Zope3-Users] assigning roles to principals onAuthenticatedPrincipalCreated event Hello zope3-users, I am trying to do make easy user registrations for my website. but I am having problems assigning roles to the principals automatically. the question is WHEN should I assign these roles to the new principals? which is the standard procedure? right now I am doing : 1. User accounts (InternalPrincipal) are created. 2. The first time the user logs in a role with id="isi.member" will be assigned to it on the whole site so the user receives membership permissions. *configure.zcml* *userhome.py class UserLoggedIn(object): def __init__(self, event): userAnno=zapi.getUtility(IPrincipalAnnotationUtility, 'ISIUserAnnotation') annotations=userAnno.getAnnotations(event.principal) if annotations.get('user_home') is None: print "***RGISTERING ANNOTATIONS*" annotations['user_home'] = Folder() annotations['user_home']['register'] = PersistentDict() annotations['user_home']['personal'] = Person() annotations['user_home']['personal'].first='hassan' annotations['user_home']['personal'].last='alirezaei' annotations['user_home']['testing'] = "TESTING THE NEW USER" siteroot=getSite() prm=IPrincipalRoleManager(siteroot) print "**for %s ***" %siteroot prm.assignRoleToPrincipal('isi.member', event.principal) ** getSite() gives mebut when i go to this object (my main site root) and change to "Grant" from zmi_actions menu the role is still unset for the user. any help is highly appreciated. it is very much possible I am doing the hard way to perform the task. Thank you in advance! Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Problem with containment and @@absolut_url
Achim, context/articles would return the id's >>> d = {'one':1, 'two':2} >>> for item in d: ... item ... 'one' 'two' The id is a string which has a title method (capitalize each worlds first letter); this is why your article/title is working. >>> for item in d: ... item.title() ... 'One' 'Two' You probably should use context/articles/values for the loop. Cheers, Mats > Hi, > > I have implemented ArticleFolder and Article like this: > > > class Article(Persistent,Contained): > implements(IArticle) > title=u'' > body=u'' > > class ArticleFolder(Folder): > implements(IArticleFolder) > > > Via ZMI I can add, edit and delete articles without problems. I use this > TAL statement in a view for the object holding the article folder : > > > tal:content="article/title" > tal:attributes="href article/@@absolute_url">asdf > > > This fails with an "There isn't enough context to get URL information." > exception. When the exception is thrown, I see in the debugger, that the > context of AbsoluteUrl is the id of the first article as unicode string. > And this string has of course no __parent__ attribute!? > > I argued that context/articles might return ids, not objects, but in > that case article/title should fail also. But if I remove > tal:attributes, it works fine. > > Am I missing something? > > regards, > Achim > ___ > Zope3-users mailing list > Zope3-users@zope.org > http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] MultiCheckBoxWidget and formlib
Could anyone give me a hint on setting up a MultiCheckBoxWidget with formlib? This is what I got: class IMySchema(Interface): multichoice = Set( title=_('Pick one or many'), value_type = Choice(values=['one', 'two', 'three'])) class MyEditForm(form.EditForm): form_fields = form.Fields(IMySchema) form_fields['multichoice'].custom_widget = What in the world do I do to get this to work? Any help greatly appreciated. Sincerely, Mats ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Accessing sub objects view class?
I’m trying to figure out how to access a sub objects view class. 1. 2. Title 3. Description 4. 5. 6. 7. 8. 9. 10. 11. 12. I’m trying to format the description of subobject ‘item’ on line 8 with its renderDescription function, just like parent object on line 3, but can’t seem to figure out how. Perhaps I’m going about it completely wrong. Any help appreciated. Mats ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Prevent Duplicate Persistency
This could be done by using the URL as the name for the Mark object. from zope.app.container.contained import NameChooser Class MarkNameChooser(NameChooser): def chooseName(self, name, object): name = object.url self.checkName(name, object) return name Make sure your Mark object is configured with set_before_add -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dax Sent: Tuesday, March 14, 2006 8:00 PM To: zope3-users@zope.org Subject: [Zope3-Users] Prevent Duplicate Persistency For the following example (taken from "Zope3 In 30 Minutes"): class IMark(Interface): """This is the book mark object.""" url = TextLine( title=u"URL/Link", description=u"URL of the website", default=u"http://www.zope.org";, required=True) description = Text( title=u"Description", description=u"Description of the website", default=u"", required=False) How can I prevent Mark objects from having the same url? So if a Mark object exists in BookMarker with Mark.url="http://www.zope.org/";, how can I prevent another Mark object from being added when its url is "http://www.zope.org";? Thanks. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users