Hello all, I'm working the Zoo guestbook example: http://www.zope.org/Members/michel/ZB/SimpleExamples.html and have created all the documents which seem to work fine. The Python method addEntry that drives the actual update of the database I created by doing an add python script then putting the code in just like the example as follows: """ Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds()) # create the document context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title="", file=comments) # add a guest_name string property doc=getattr(context, id) doc.manage_addProperty('guest_name', guest_name, 'string') Syntactically it looks good to Zope, but it has a problem with the 'context' variable and doesn't seem to know what it is. Any idea what I might be doing wrong? -- IV
The examples in the ZB are suppossed to work with Zope 2.3 only. Probably you are using an older version. I got the examples running by replacing 'context' with 'self' (and maybe some other minor changes, that I cant't remember). Good luck! Markus Kemmerling
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ignacio Valdes Sent: Wednesday, February 07, 2001 6:09 AM To: zope@zope.org Subject: [Zope] Zoo guestbook example.
Hello all,
I'm working the Zoo guestbook example:
http://www.zope.org/Members/michel/ZB/SimpleExamples.html
and have created all the documents which seem to work fine. The Python method addEntry that drives the actual update of the database I created by doing an add python script then putting the code in just like the example as follows:
""" Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds())
# create the document context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title="", file=comments)
# add a guest_name string property doc=getattr(context, id) doc.manage_addProperty('guest_name', guest_name, 'string')
Syntactically it looks good to Zope, but it has a problem with the 'context' variable and doesn't seem to know what it is. Any idea what I might be doing wrong?
-- IV
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Thanks Markus, I'm working in a production environment so I won't be able to upgrade until 2.4 I tried changing the variables from context to self, but that made it unable to find 'self' unfortunately. I'm clueless about what to do now as this is the first Python I've ever programmed. -- IV Markus Kemmerling wrote:
The examples in the ZB are suppossed to work with Zope 2.3 only. Probably you are using an older version. I got the examples running by replacing 'context' with 'self' (and maybe some other minor changes, that I cant't remember).
Good luck!
Markus Kemmerling
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ignacio Valdes Sent: Wednesday, February 07, 2001 6:09 AM To: zope@zope.org Subject: [Zope] Zoo guestbook example.
Hello all,
I'm working the Zoo guestbook example:
http://www.zope.org/Members/michel/ZB/SimpleExamples.html
and have created all the documents which seem to work fine. The Python method addEntry that drives the actual update of the database I created by doing an add python script then putting the code in just like the example as follows:
""" Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds())
# create the document context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title="", file=comments)
# add a guest_name string property doc=getattr(context, id) doc.manage_addProperty('guest_name', guest_name, 'string')
Syntactically it looks good to Zope, but it has a problem with the 'context' variable and doesn't seem to know what it is. Any idea what I might be doing wrong?
-- IV
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Ignacio Valdes wrote:
Thanks Markus, I'm working in a production environment so I won't be able to upgrade until 2.4 I tried
You can install 2.3 and run it on a different port. Then start moving everything over until you're sure it works. Good Luck, -- Tim Cook, President -- Free Practice Management,Inc. | http://www.FreePM.com Office: (901) 884-4126 "Liberty has never come from the government." - Woodrow Wilson
I tried this with Zope 2.2.4. It works: id='entry_%d' % len(self.objectIds()) self.manage_addDTMLDocument(id, title="", file=comments) doc=getattr(self, id) doc.manage_addProperty('guest_name', guest_name, 'string') I hope you haven't given up yet. Markus Kemmerling
Markus Kemmerling wrote:
I tried this with Zope 2.2.4. It works:
id='entry_%d' % len(self.objectIds()) self.manage_addDTMLDocument(id, title="", file=comments) doc=getattr(self, id) doc.manage_addProperty('guest_name', guest_name, 'string')
I hope you haven't given up yet.
Markus Kemmerling
Haven't given up, I was just resting! :-) Tried the above, still didn't like 'self', (the variable, not myself) but I don't know what Zope my ISP is running and I tried to RTFM, but this resulted in a bajillion hits on the word 'version'. That's the problem is that what I'm going to derive from the guest book example needs to run on my ISP's server. Thanks! -- IV
You do have 'self' in the parameter-list? Markus Kemmerling
I tried this with Zope 2.2.4. It works:
id='entry_%d' % len(self.objectIds()) self.manage_addDTMLDocument(id, title="", file=comments) doc=getattr(self, id) doc.manage_addProperty('guest_name', guest_name, 'string')
I hope you haven't given up yet.
Markus Kemmerling
Haven't given up, I was just resting! :-) Tried the above, still didn't like 'self', (the variable, not myself) but I don't know what Zope my ISP is running and I tried to RTFM, but this resulted in a bajillion hits on the word 'version'. That's the problem is that what I'm going to derive from the guest book example needs to run on my ISP's server. Thanks! -- IV
Good. Tried it, now I get this message: Zope Error Zope has encountered an error while publishing this resource. Error Type: AttributeError Error Value: 'string' object has no attribute 'objectIds' Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /home/zope/zope4/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /home/zope/zope4/lib/python/ZPublisher/Publish.py, line 187, in publish File /home/zope/zope4/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /home/zope/zope4/lib/python/ZPublisher/Publish.py, line 171, in publish File /home/zope/zope4/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: addEntryAction) File /home/zope/zope4/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: addEntryAction) File /home/zope/zope4/lib/python/OFS/DTMLMethod.py, line 172, in __call__ (Object: addEntryAction) File /home/zope/zope4/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__ (Object: addEntryAction) File /home/zope/zope4/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval (Object: addEntry(guest_name, comments)) (Info: guest_name) File <string>, line 0, in ? File /home/zope/zope4/lib/python/Products/PythonMethod/PythonMethod.py, line 168, in __call__ (Object: addEntry) (Info: (('Anonymous', 'test'), {}, None)) File <string>, line 2, in addEntry AttributeError: (see above) With this code, with guest_name and self as parameters. id='entry_%d' % len(self.objectIds()) self.manage_addDTMLDocument(id, title="", file=comments) doc=getattr(self, id) doc.manage_addProperty('guest_name', guest_name, 'string') -- IV
Markus Kemmerling wrote:
I tried this with Zope 2.2.4. It works:
id='entry_%d' % len(self.objectIds()) self.manage_addDTMLDocument(id, title="", file=comments) doc=getattr(self, id) doc.manage_addProperty('guest_name', guest_name, 'string')
I hope you haven't given up yet.
Markus Kemmerling
I'm running Zope version: Zope 2.2.2 (binary release, python 1.5.2, linux2-x86) and can't upgrade anytime soon. Any hope for getting the above running? It is the base for something I'm creating. As David Bowman in 2010 said 'something wonderful.' Daisy, daisy... Don't worry about these last sentences if you haven't read Arthur Clarke. -- IV
participants (3)
-
Ignacio Valdes -
Markus Kemmerling -
Tim Cook