[Zope-dev] Zope Tests: 5 OK
Summary of messages to the zope-tests list. Period Thu Jun 14 12:00:00 2007 UTC to Fri Jun 15 12:00:00 2007 UTC. There were 5 messages: 5 from Zope Unit Tests. Tests passed OK --- Subject: OK : Zope-2.7 Python-2.3.6 : Linux From: Zope Unit Tests Date: Thu Jun 14 20:52:58 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-June/007884.html Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Unit Tests Date: Thu Jun 14 20:54:28 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-June/007885.html Subject: OK : Zope-2.9 Python-2.4.4 : Linux From: Zope Unit Tests Date: Thu Jun 14 20:55:59 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-June/007886.html Subject: OK : Zope-2.10 Python-2.4.4 : Linux From: Zope Unit Tests Date: Thu Jun 14 20:57:33 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-June/007887.html Subject: OK : Zope-trunk Python-2.4.4 : Linux From: Zope Unit Tests Date: Thu Jun 14 20:59:05 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-June/007888.html ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope] zope stopped working suddenly
Greetings thank you for your help. first i want to ask if i should reply to you like what i am doing now, or send the message to zope@zope.org mailto:zope@zope.org? I am new to mailing lists and don't know the rules. You should always stay on the list. It is common to just use 'Reply all' option when replying. In my zope/log folder there is no event.log file, just a simple line readme.txt file. running the zopectl fg displayed the following: /** OUTPUT **/ /tmp/zope/bin/runzope -X debug-mode=on 2007-06-15 09:33:41 INFO ZServer HTTP server started at Fri Jun 15 09:33:41 2007 Hostname: 0.0.0.0 http://0.0.0.0 Port: 8080 2007-06-15 09:33:51 INFO Zope Ready to handle requests Traceback (most recent call last): File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 56, in ? run() File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 21, in run starter.prepare() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 111, in prepare self.setupFinalLogging() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 372, in setupFinalLogging self.setupConfiguredLoggers() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 254, in setupConfiguredLoggers self.cfg.eventlog() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/factory.py, line 32, in __call__ self.instance = self.create() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/logger.py, line 42, in create handler = handler_factory() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/factory.py, line 32, in __call__ self.instance = self.create() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py, line 69, in create logger = self.create_loghandler() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py, line 87, in create_loghandler handler = loghandler.FileHandler(path) File /opt/Zope- 2.10/lib/python/ZConfig/components/logger/loghandler.py, line 34, in __init__ StreamHandler.__init__(self, open(filename, mode)) IOError: [Errno 13] Permission denied: '/tmp/zope/log/event.log' /** END **/ So seems that you have incorrect permissions set for /tmp/zope/log/event.log and you need to change them or start zope as different user. BTW you've chosen strange place (/tmp) to install your zope ;) -- Maciej Wisniowski ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] zope stopped working suddenly
On 6/15/07, Maciej Wisniowski [EMAIL PROTECTED] wrote: Greetings thank you for your help. first i want to ask if i should reply to you like what i am doing now, or send the message to zope@zope.org mailto: zope@zope.org? I am new to mailing lists and don't know the rules. You should always stay on the list. It is common to just use 'Reply all' option when replying. In my zope/log folder there is no event.log file, just a simple line readme.txt file. running the zopectl fg displayed the following: /** OUTPUT **/ /tmp/zope/bin/runzope -X debug-mode=on 2007-06-15 09:33:41 INFO ZServer HTTP server started at Fri Jun 15 09:33:41 2007 Hostname: 0.0.0.0 http://0.0.0.0 Port: 8080 2007-06-15 09:33:51 INFO Zope Ready to handle requests Traceback (most recent call last): File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 56, in ? run() File /opt/Zope- 2.10/lib/python/Zope2/Startup/run.py, line 21, in run starter.prepare() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 111, in prepare self.setupFinalLogging () File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 372, in setupFinalLogging self.setupConfiguredLoggers() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 254, in setupConfiguredLoggers self.cfg.eventlog() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/factory.py, line 32, in __call__ self.instance = self.create() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/logger.py, line 42, in create handler = handler_factory() File /opt/Zope- 2.10/lib/python/ZConfig/components/logger/factory.py, line 32, in __call__ self.instance = self.create() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py, line 69, in create logger = self.create_loghandler() File /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py, line 87, in create_loghandler handler = loghandler.FileHandler(path) File /opt/Zope- 2.10/lib/python/ZConfig/components/logger/loghandler.py, line 34, in __init__ StreamHandler.__init__(self, open(filename, mode)) IOError: [Errno 13] Permission denied: '/tmp/zope/log/event.log' /** END **/ So seems that you have incorrect permissions set for /tmp/zope/log/event.log and you need to change them or start zope as different user. BTW you've chosen strange place (/tmp) to install your zope ;) what is strange is that event.log does not actually exist in the log folder, I deleted the /tmp/zope folder and deleted the opt/Zope-2.10 , and installed zope again and created a new instance in /opt/zope. I am still working in root, and the problem still exist. running ./zopectl fg couldn't continue : /** OUTPUT **/ [EMAIL PROTECTED] bin]# ./zopectl fg /opt/zope/bin/runzope -X debug-mode=on 2007-06-15 11:39:34 INFO ZServer HTTP server started at Fri Jun 15 11:39:34 2007 Hostname: 0.0.0.0 Port: 8080 2007-06-15 11:39:34 CRITICAL Zope A user was not specified to setuid to; fix this to start as root (change the effective-user directive in zope.conf) Traceback (most recent call last): File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 56, in ? run() File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 21, in run starter.prepare() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 98, in prepare self.dropPrivileges() File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 234, in dropPrivileges return dropPrivileges(self.cfg) File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 403, in dropPrivileges raise ZConfig.ConfigurationError(msg) ZConfig.ConfigurationError: A user was not specified to setuid to; fix this to start as root (change the effective-user directive in zope.conf) /** END **/ When everything was ok in the past I was able to run zope through ./zopectl start (as a root) but now the stop command displays that the daemon manager is not open. -- Maciej Wisniowski ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] zope stopped working suddenly
File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 234, in dropPrivileges return dropPrivileges(self.cfg) File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line 403, in dropPrivileges raise ZConfig.ConfigurationError(msg) ZConfig.ConfigurationError: A user was not specified to setuid to; fix this to start as root (change the effective-user directive in zope.conf) /** END **/ You have answer above. To run as root you have to change effective-user at zope.conf file When everything was ok in the past I was able to run zope through ./zopectl start (as a root) but now the stop command displays that the daemon manager is not open. Strange that it worked. In general I think you shouldn't run zope as root. -- Maciej Wisniowski ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
- Original Message - From: Tom Von Lahndorff [EMAIL PROTECTED] To: zope@zope.org Sent: Friday, June 15, 2007 10:18 AM Subject: [Zope] Dictionary Key Error from Parsed RSS Hi everyone, I've used Universal Feed Parser to parse an RSS feed. Then used these instructions below to get the parsed data into Zope via an External Method. Everything seems to work fine except that I keep getting an error whenever I try to access a key from the returned data. The resulting data is returned as a dictionary and if I render it as is it works fine, however in both ZPT and DTML, when trying to access a key, for instance feed or href from the dictionary I'm prompted to login, which I'm unable to do with my admin login. After hitting cancel I get a Key Error that says You are not able to access 'href' (or whatever) in this context. Is there any way to somehow let Zope know that this data is 'ok'? Thanks in advance. You should post the full Key Error message with traceback (from error_log in the root folder of the zmi). Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
--On 15. Juni 2007 10:18:20 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: I'm prompted to login, - use VerboseSecurity which I'm unable to do with my admin login. After hitting cancel I get a Key Error that says You are not able to access 'href' (or whatever) in this context. You must provide the full traceback. -aj pgp3DhwdmKNke.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Dictionary Key Error from Parsed RSS
Hi everyone, I've used Universal Feed Parser to parse an RSS feed. Then used these instructions below to get the parsed data into Zope via an External Method. Everything seems to work fine except that I keep getting an error whenever I try to access a key from the returned data. The resulting data is returned as a dictionary and if I render it as is it works fine, however in both ZPT and DTML, when trying to access a key, for instance feed or href from the dictionary I'm prompted to login, which I'm unable to do with my admin login. After hitting cancel I get a Key Error that says You are not able to access 'href' (or whatever) in this context. Is there any way to somehow let Zope know that this data is 'ok'? Thanks in advance. Pre-requisites == - Zope 2.5.x (developed and tested with Zope 2.5.1, but other minor versions should work as well) - feedparser.py 3.0 (http://diveintomark.org/projects/feed_parser/) developed and tested with 3.0 beta 22, the latest version Installation 1. Installing feedparser.py --- 1.1. Unzip the archive (preserving path names) into /Zopesite/bin/lib/ 1.2. open a command prompt window and go to /Zopesite/bin/lib/ feedparser/ 1.3. enter the command (sans quotes): '..\..\python setup.py install' 1.4. after installation, enter the command: '..\..\python feedparsertest.py' 1.5. wait for testing to complete. On my laptop, 2051 tests ran in 118.481s 2. Installing the external method - 2.1 place the newsfeed.py module in the /Zopesite/Extensions/ directory 2.2 Add an external method to your zope site with an id and Module of 'newsfeed', and a function of 'parsefeed' 3. Installing the feed template --- 3.1 Add a Page template to your Zope site with the contents of the nprnews.pt Page Template 3.2 examine the generic template rendering of NPR News, all fields from the feed should be available. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Packing the Data.fs with wget fails since 2.9.7
Andreas Jung, on 2007-06-14: Write a PythonScript within the ZMI that calls the pack operation. Then call *this* script through wget. I have found an alternative with urllib2. I added it to instancemanager. For those interested, see this changeset: http://dev.plone.org/collective/changeset/43815 Basically it is this: import urllib2 import base64 # Create a request req = urllib2.Request(url=http://localhost:8080/Control_Panel/ Database/manage_pack?days:float=7) # Add an authorization header auth = base64.encodestring(user:password) req.add_header('Authorization', Basic %s % auth) # Use POST instead of GET: needed at least in Zope 2.9.7 req.add_data('POST') info = urllib2.urlopen(req) -- Maurits van Rees | http://maurits.vanrees.org/ [NL] Work | http://zestsoftware.nl/ Do not worry about your difficulties in computers, I can assure you mine are still greater. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/ rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context 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 error log. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): * Module ZPublisher.Publish, line 115, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 41, in call_object * Module OFS.DTMLMethod, line 144, in __call__ DTMLMethod at /feeds/nprnews.html URL: http://localhost:8080/feeds/nprnews.html/manage_main Physical Path:/feeds/nprnews.html * Module DocumentTemplate.DT_String, line 476, in __call__ * Module DocumentTemplate.DT_Let, line 76, in render * Module DocumentTemplate.DT_Util, line 196, in eval __traceback_info__: news * Module string, line 1, in expression Unauthorized: You are not allowed to access 'feed' in this context On Jun 15, 2007, at 10:21 AM, Jonathan wrote: - Original Message - From: Tom Von Lahndorff [EMAIL PROTECTED] To: zope@zope.org Sent: Friday, June 15, 2007 10:18 AM Subject: [Zope] Dictionary Key Error from Parsed RSS Hi everyone, I've used Universal Feed Parser to parse an RSS feed. Then used these instructions below to get the parsed data into Zope via an External Method. Everything seems to work fine except that I keep getting an error whenever I try to access a key from the returned data. The resulting data is returned as a dictionary and if I render it as is it works fine, however in both ZPT and DTML, when trying to access a key, for instance feed or href from the dictionary I'm prompted to login, which I'm unable to do with my admin login. After hitting cancel I get a Key Error that says You are not able to access 'href' (or whatever) in this context. Is there any way to somehow let Zope know that this data is 'ok'? Thanks in advance. You should post the full Key Error message with traceback (from error_log in the root folder of the zmi). Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
--On 15. Juni 2007 11:45:49 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context Likely because the module has no security assertions. All your stuff runs under the conditions of Restricted Python. The standard Zope security applies. -aj pgpZxlGOV6FfQ.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
shouldnt this prevent that? def dictify(p): Since the FeedParser returns a dictionary-like class instance, rather than a real dictionary, We must iterate through all nested instances and convert them to dicts to avoid security problems within Zope. I have no idea *why* feedparser doesn't just use real nested dicts in the first place. newdict = {} if type(p) in [types.DictionaryType, types.InstanceType]: d = p # for clarity for k,v in d.items(): newdict[k] = dictify(v) elif type(p) == types.ListType: l = p # for clarity for ss,v in zip(xrange(len(l)), l): l[ss] = dictify(v) return l else: return p return newdict On Jun 15, 2007, at 11:49 AM, Andreas Jung wrote: --On 15. Juni 2007 11:45:49 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/ rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context Likely because the module has no security assertions. All your stuff runs under the conditions of Restricted Python. The standard Zope security applies. -aj ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
No idea what this method should tell use?! Your code uses news.feed.href...nothing's like that can be found here in the code. We can not guess what this snippet is doing and where and why. -aj --On 15. Juni 2007 12:02:48 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: shouldnt this prevent that? def dictify(p): Since the FeedParser returns a dictionary-like class instance, rather than a real dictionary, We must iterate through all nested instances and convert them to dicts to avoid security problems within Zope. I have no idea *why* feedparser doesn't just use real nested dicts in the first place. newdict = {} if type(p) in [types.DictionaryType, types.InstanceType]: d = p # for clarity for k,v in d.items(): newdict[k] = dictify(v) elif type(p) == types.ListType: l = p # for clarity for ss,v in zip(xrange(len(l)), l): l[ss] = dictify(v) return l else: return p return newdict On Jun 15, 2007, at 11:49 AM, Andreas Jung wrote: --On 15. Juni 2007 11:45:49 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/ rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context Likely because the module has no security assertions. All your stuff runs under the conditions of Restricted Python. The standard Zope security applies. -aj -- ZOPYX Ltd. Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK E-Publishing, Python, Zope Plone development, Consulting pgpiQY7pxdE3Q.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Auto Cataloging my ZCatalog
Hello, I have a ZCatalog that my users use to catalog there news articles which are (DTML Documents). I have already explained it to them to always input the id for the new DTML Documents under with ids section on the Find Objects tab on the ZMI to catalog new articles. But most time they will not and they end up cataloging the entire articles which runs to 13,000 records. What i want is either to be able to display error when the with ids is missing on Find Objects form or to be able to automate it. For example use a python code. I am new to python but very eager to learn. Any help will be highly appreciated.___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Auto Cataloging my ZCatalog
- Original Message - From: kamal hamzat [EMAIL PROTECTED] To: zope@zope.org Sent: Friday, June 15, 2007 12:51 PM Subject: [Zope] Auto Cataloging my ZCatalog Hello, I have a ZCatalog that my users use to catalog there news articles which are (DTML Documents). I have already explained it to them to always input the id for the new DTML Documents under with ids section on the Find Objects tab on the ZMI to catalog new articles. But most time they will not and they end up cataloging the entire articles which runs to 13,000 records. What i want is either to be able to display error when the with ids is missing on Find Objects form or to be able to automate it. For example use a python code. I am new to python but very eager to learn. One possible approach: - I would not allow end-users access to the ZMI. - Have users interact with the application through a menu driven interface - Use a series of forms to collect data, then use python scripts/external methods to create/store objects (eg. your DTML Documents) and update the ZCatalog(s). This will give you total control over user-entered data and the actions that are taken (based on their input). hth Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
Here's a snippet of the rendered RSS feed: {'feed': {'subtitle': u'', 'links': [{'href': u'http:// www.modscape.com/blog', 'type': 'text/html', 'rel': 'alternate'}], 'title': u'modscape.com Home', 'subtitle_detail': {'base': 'http:// www.modscape.com/blog/rss.xml', 'type': 'text/html', 'value': u'', 'language': None}, 'title_detail': {'base': 'http://www.modscape.com/ blog/rss.xml', 'type': 'text/plain', 'value': u'modscape.com Home', 'language': None}, 'link': u'http://www.modscape.com/blog'}, 'status': 200, 'updated': (2007, 6, 15, 16, 48, 28, 4, 166, 0), 'version': 'rss20', 'encoding': 'iso-8859-15', 'bozo': 0, 'headers': {'content-length': '18486', 'via': '1.0 px04.bc.fw.cbs.net:80 (squid)', 'x-cache': 'MISS from px04.bc.fw.cbs.net', 'x-powered-by': 'Zope (www.zope.org), Python (www.python.org)', 'x-cache-lookup': 'HIT from px04.bc.fw.cbs.net:80', 'expires': 'Fri, 15 Jun 2007 17:48:28 GMT', 'server': 'Apache/2.0.52 (Red Hat) DAV/2 SVN/1.2.3 mod_ssl/2.0.52 OpenSSL/0.9.7a PHP/5.1.2 mod_fastcgi/2.4.2', 'last- modified': 'Fri, 15 Jun 2007 16:48:28 GMT', 'connection': 'close', 'cache-control': 'max-age=3600', 'date': 'Fri, 15 Jun 2007 16:48:28 GMT', 'content-type': 'text/xml; charset=iso-8859-15'}, 'etag': None, 'href': 'http://www.modscape.com/blog/rss.xml', 'namespaces': {}, 'entries': [{'updated': u'Mon, Sep 04 2006, 06:23PM', 'updated_parsed': None, 'links': [{'href': u'http://www.modscape.com/ blog/index_html?showall=yes#id1157412223', 'type': 'text/html', 'rel': 'alternate'}], 'title': u'Ubuntu: Linux For Human Beings', 'summary_detail': {'base': 'http://www.modscape.com/blog/rss.xml', 'type': 'text/html', 'value': u'img src=http://www.modscape.com/ blog/1157412223/ubuntu.jpg width=150 alt=ubuntu.jpg align=right hspace=10 /\n\nTom wrote:br /br /\n\na href=http://www.ubuntu.com/;Ubuntu/a is an easy On Jun 15, 2007, at 12:17 PM, Andreas Jung wrote: No idea what this method should tell use?! Your code uses news.feed.href...nothing's like that can be found here in the code. We can not guess what this snippet is doing and where and why. -aj --On 15. Juni 2007 12:02:48 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: shouldnt this prevent that? def dictify(p): Since the FeedParser returns a dictionary-like class instance, rather than a real dictionary, We must iterate through all nested instances and convert them to dicts to avoid security problems within Zope. I have no idea *why* feedparser doesn't just use real nested dicts in the first place. newdict = {} if type(p) in [types.DictionaryType, types.InstanceType]: d = p # for clarity for k,v in d.items(): newdict[k] = dictify(v) elif type(p) == types.ListType: l = p # for clarity for ss,v in zip(xrange(len(l)), l): l[ss] = dictify(v) return l else: return p return newdict On Jun 15, 2007, at 11:49 AM, Andreas Jung wrote: --On 15. Juni 2007 11:45:49 -0400 Tom Von Lahndorff [EMAIL PROTECTED] wrote: dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/ rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context Likely because the module has no security assertions. All your stuff runs under the conditions of Restricted Python. The standard Zope security applies. -aj -- ZOPYX Ltd. Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK -- -- E-Publishing, Python, Zope Plone development, Consulting ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Dictionary Key Error from Parsed RSS
Tom Von Lahndorff wrote at 2007-6-15 11:45 -0400: dtml-let news=newsfeed(feedurl='http://www.modscape.com/blog/ rss.xml') dtml-var news.feed.href /dtml-let gives: Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access 'feed' in this context ... If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): * Module ZPublisher.Publish, line 115, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 41, in call_object * Module OFS.DTMLMethod, line 144, in __call__ DTMLMethod at /feeds/nprnews.html URL: http://localhost:8080/feeds/nprnews.html/manage_main Physical Path:/feeds/nprnews.html * Module DocumentTemplate.DT_String, line 476, in __call__ * Module DocumentTemplate.DT_Let, line 76, in render * Module DocumentTemplate.DT_Util, line 196, in eval __traceback_info__: news * Module string, line 1, in expression Unauthorized: You are not allowed to access 'feed' in this context It is likely that the object looks like a dictionary (it uses a string representation like that of a true 'dict') but it is not a proper dictionary (but rather some instance of a class). Zope's restricted code treats proper dictionaries as unprotected (like it does for lists and tuples) but requires special security declarations for instances to be accessible in untrusted code. A solution for you might be to convert the RSS data into a proper dictionary. How this works in detail depends on the instance at hand. If it implementes an items method, then dict(instance.items()) would do it. Note that substructures, too, may look like Python types but are in fact instances. In this case, you would need to convert such substructures as well (similar to the top level object). -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-DB] Using dtml-vars in ZSQL methods?
Here's the definition of a ZSQL method, people_delete_by_id.zsql: dtml-comment title: Method to delete People by ids given in a comma-separated list connection_id: my_database arguments: id_list /dtml-comment delete from person where person_id in (dtml-var id_list) Here's the puzzle: When I define and test this ZSQL method through the ZMI, passing it a string such as 9765, 10058, 11333, it indeed deletes the rows with those values on person_id. BUT when I invoke the same ZSQL method from a Python script with the following code: p = context.REQUEST.get('delete_this') if p: s = ', '.join([str(x) for x in p]) context.people_delete_by_id(id_list=s) ...and with a REQUEST variable 'delete_this' that comes from this snippet of a form in a page template: form method=post name=form2 tal:attributes=action string:${here/absolute_url}/${template/id}; input type=hidden name=form.submitted value=1 / p class=error_message tal:define=err errors/n|nothing tal:condition=errb tal:content=err //p table tr tal:repeat=person options/dataa name=id id=id tal:attributes=name person/person_id/a td tal:condition=not:options/selectall | nothing input type=checkbox name=delete_this:list:int value= tal:attributes=value person/person_id/ /td ... /tr /table ... /form ...and with the same three person_ids (9765, 10058, 11333) the 4th line of the Python script evokes an error: KeyError: 'id_list' The core idea is that the string id_list is passed into the ZSQL method, where it is spliced into the delete...where clause via the dtml-var id_list) to provide the list of person_ids to delete. Here's the question: WHY? ~ TIA ~ Ken P.S. I know that dtml-var... rather than dtml-sqlvar... is an unorthodox and apparently undocumented construct to use within a ZSQL definition. But I need it because dtml-sqlvar... malformats the string. And if doing this trick is a no-no, how come it works in the ZMI test but not when called from Python? More importantly, how can I get it to work from Python? ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db