RE: [Zope] Script execute with every request
Say no more, that’s exactly what I was looking for. I just (zope 2.6.4) selected "Set access Rule" in the zmi and click Add, enter the name of the script I want to execute and that’s it. I knew there had to be a simple way. Thanks a lot Dieter, Josh -Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED] Sent: Tuesday, 25 July 2006 4:01 AM To: Joshua Burvill Cc: 'David H'; zope@zope.org Subject: RE: [Zope] Script execute with every request Joshua Burvill wrote at 2006-7-24 14:01 +1000: > ... >Basically I just want to do an insert into a database of some stuff from >each request. Sounds like work for a "SiteAccess" "AccessRule"... -- Dieter -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.4/396 - Release Date: 24/07/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.4/396 - Release Date: 24/07/2006 ___ 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] variable propagation
Pavel Zaitsev wrote: В Пнд, 24/07/2006 в 15:00 -0700, David H пишет Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have submit with an action="" and method="post". Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. here is description: root/ index_html index_tmpl <-- invokes here.content_html root/some/web/page index_html <-- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html <-- gets called from index_tmpl So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel Pavel, How are you invoking templates? Give code snippets. Have you read the "Advanced Scripting" section in the Zope book? Plope.com has a the latest version (i think). David ___ 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] variable propagation
В Пнд, 24/07/2006 в 15:00 -0700, David H пишет > Pavel, > > You question is a bit vague but ... > > Make your index_html a python script. And then stuff your REQUEST with > info you want > > Then just call the Page Template ... > > request.set('formvar1', somevalue) > return context.myPageTemplate(context.request) > > Of course of you have submit with an action="." and method="post". > > Then you can intercept all calls using index_html, do what you need to > do and *then* render the next form. here is description: root/ index_html index_tmpl <-- invokes here.content_html root/some/web/page index_html <-- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html <-- gets called from index_tmpl So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel ___ 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] variable propagation
Pavel Zaitsev wrote: Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to "generic" template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have submit with an action="." and method="post". Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. David ___ 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] Re: accessing object from a list constructed in __init__.py
Thank you everybody for your input and help with this. What was explained to me and what I missed when reading about acquisition is that _getattr_ is used by acquisition to return attributes in context. If your objects are in a list, _getattr_ is not available, but _getitem_ is used to return the objects. So there are two solutions and two schools of thought on how to solve this. Some will over ride _getitem_ so that lists return object.__of__(self) , others will wrap the objects manually. The second solution is the one that I took. I wrote a method for my class that takes an integer and will return that element from the list as a wrapped object. simply def getObject(self,i): '''return wrapped object from list''' object = self.list.__of__(self) return object Thanks again everyone for your help. -Kevin ___ 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] variable propagation
Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to "generic" template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel ___ 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] Mark Pilgrim's Feed Parser in Zope
I'm trying to move our sites from Zope 2.5.1 to Zope 2.8.1-final and I'm receiving an error with this script: http://www.zope.org/Members/johntynan/feedparser/ In particular, I receive the following error, when using the attached page template "nprnews.pt": "Unauthorized: You are not allowed to access 'a particular list' in this context" (see traceback.txt attached). This page template renders an rss feed that has been transformed into a dictionary (see "dictionary.txt" attached) via a python script ("feedscript") which calls an external method ("newsfeed") which uses Mark Pilgrim's feed parser to parse the xml into a python data type. If I run the python script or the external method directly (via the "test" tab in the ZMI) I have no problem viewing all the properties of the rss feed. However, if I use the page template, I still receive this error. I've tried to get around this by running the python script using a proxy role of manager or owner, but I still receive the same error. Any suggestions you might have are appreciated. John Tynan - webmaster KJZZ.org / KBAQ.org 480.774.8462 Traceback (innermost last): Module ZPublisher.Publish, line 113, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.DTMLDocument, line 128, in __call__ - - URL: http://localhost/news/index_html/manage_main - Physical Path: /news/index_html Module DocumentTemplate.DT_String, line 476, in __call__ Module DocumentTemplate.DT_Util, line 196, in eval - __traceback_info__: npr Module , line 1, in Module Shared.DC.Scripts.Bindings, line 311, in __call__ Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec Module Products.PageTemplates.ZopePageTemplate, line 256, in _exec Module Products.PageTemplates.PageTemplate, line 102, in pt_render - Module TAL.TALInterpreter, line 206, in __call__ Module TAL.TALInterpreter, line 250, in interpret Module TAL.TALInterpreter, line 649, in do_loop_tal Module Products.PageTemplates.TALES, line 206, in setRepeat Module Products.PageTemplates.TALES, line 221, in evaluate - URL: /newsstories - Line 2, Column 2 - Expression: - Names: {'container': , 'context': , 'default': , 'here': , 'loop': , 'modules': , 'nothing': None, 'options': {'args': (None, )}, 'repeat': , 'request': http://localhost/news/index_html>, 'root': , 'template': , 'traverse_subpath': [], 'user': admin} Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ - __traceback_info__: news['entries'][0:4] Module Python expression "news['entries'][0:4]", line 1, in Module AccessControl.ZopeGuards, line 71, in guarded_getitem Unauthorized: You are not allowed to access 'a particular list' in this context {'feed': {'lastbuilddate': u'Mon, 24 Jul 2006 12:06:18 EDT', 'subtitle': u'U.S.', 'generator': u'NPR/RSS Generator 2.0', 'links': [{'href': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'type': 'text/html', 'rel': 'alternate'}, {'type': 'text/html', 'rel': 'alternate'}], 'title': u'NPR Topics: Nation', 'image': {'href': u'http://www.npr.org/images/npr_news_123x20.gif', 'link': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'title': u'Nation'}, 'rights': u'Copyright 2006 NPR - For Personal Use Only', 'generator_detail': {'name': u'NPR/RSS Generator 2.0'}, 'subtitle_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/html', 'value': u'U.S.', 'language': None}, 'title_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/plain', 'value': u'NPR Topics: Nation', 'language': None}, 'link': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'rights_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/plain', 'value': u'Copyright 2006 NPR - For Personal Use Only', 'language': None}}, 'status': 200, 'updated': (2006, 7, 24, 17, 53, 55, 0, 205, 0), 'version': 'rss20', 'encoding': 'us-ascii', 'bozo': 0, 'headers': {'content-length': '17980', 'set-cookie': 'v1st=1DCE87E4F229957A; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.npr.org, Apache=140.198.109.3.318941153763735423; path=/', 'accept-ranges': 'bytes', 'expires': 'Mon, 24 Jul 2006 17:55:35 GMT', 'server': 'Apache', 'last-modified': 'Mon, 24 Jul 2006 17:53:55 GMT', 'connection': 'close', 'etag': '"463c-44c50933"', 'cache-control': 'max-age=0', 'date': 'Mon, 24 Jul 2006 17:55:35 GMT', 'content-type': 'text/xml'}, 'etag': '"463c-44c50933"', 'href': 'http://www.npr.org/rss/rss.php?id=1003', 'namespaces': {'itunes': u'http://www.itunes.com/dtds/podcast-1.0.dtd', 'content': u'http://purl.org/rss/1.0/modules/content/', u'npr': u'http://www.npr.org/rss/'}, 'entries': [{'updated': u'Mon, 24 Jul 2006 11:09:00 EDT', 'updated_parsed': (2006, 7, 24, 15, 9, 0, 0, 205, 0), 'links': [{'href': u'http://www.npr.org/templates/stor
[Zope] Mark Pilgrim's Feed Parser in Zope
I'm trying to move our sites from Zope 2.5.1 to Zope 2.8.1-final and I'm receiving an error with this script: http://www.zope.org/Members/johntynan/feedparser/ In particular, I receive the following error, when using the attached page template "nprnews.pt": "Unauthorized: You are not allowed to access 'a particular list' in this context" (see traceback.txt attached). This page template renders an rss feed that has been transformed into a dictionary (see "dictionary.txt" attached) via a python script ("feedscript") which calls an external method ("newsfeed") which uses Mark Pilgrim's feed parser to parse the xml into a python data type. If I run the python script or the external method directly (via the "test" tab in the ZMI) I have no problem viewing all the properties of the rss feed. However, if I use the page template, I still receive this error. I've tried to get around this by running the python script using a proxy role of manager or owner, but I still receive the same error. Any suggestions you might have are appreciated. John Tynan - webmaster KJZZ.org / KBAQ.org 480.774.8462 Traceback (innermost last): Module ZPublisher.Publish, line 113, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.DTMLDocument, line 128, in __call__ - - URL: http://localhost/news/index_html/manage_main - Physical Path: /news/index_html Module DocumentTemplate.DT_String, line 476, in __call__ Module DocumentTemplate.DT_Util, line 196, in eval - __traceback_info__: npr Module , line 1, in Module Shared.DC.Scripts.Bindings, line 311, in __call__ Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec Module Products.PageTemplates.ZopePageTemplate, line 256, in _exec Module Products.PageTemplates.PageTemplate, line 102, in pt_render - Module TAL.TALInterpreter, line 206, in __call__ Module TAL.TALInterpreter, line 250, in interpret Module TAL.TALInterpreter, line 649, in do_loop_tal Module Products.PageTemplates.TALES, line 206, in setRepeat Module Products.PageTemplates.TALES, line 221, in evaluate - URL: /newsstories - Line 2, Column 2 - Expression: - Names: {'container': , 'context': , 'default': , 'here': , 'loop': , 'modules': , 'nothing': None, 'options': {'args': (None, )}, 'repeat': , 'request': http://localhost/news/index_html>, 'root': , 'template': , 'traverse_subpath': [], 'user': admin} Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ - __traceback_info__: news['entries'][0:4] Module Python expression "news['entries'][0:4]", line 1, in Module AccessControl.ZopeGuards, line 71, in guarded_getitem Unauthorized: You are not allowed to access 'a particular list' in this context {'feed': {'lastbuilddate': u'Mon, 24 Jul 2006 12:06:18 EDT', 'subtitle': u'U.S.', 'generator': u'NPR/RSS Generator 2.0', 'links': [{'href': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'type': 'text/html', 'rel': 'alternate'}, {'type': 'text/html', 'rel': 'alternate'}], 'title': u'NPR Topics: Nation', 'image': {'href': u'http://www.npr.org/images/npr_news_123x20.gif', 'link': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'title': u'Nation'}, 'rights': u'Copyright 2006 NPR - For Personal Use Only', 'generator_detail': {'name': u'NPR/RSS Generator 2.0'}, 'subtitle_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/html', 'value': u'U.S.', 'language': None}, 'title_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/plain', 'value': u'NPR Topics: Nation', 'language': None}, 'link': u'http://www.npr.org/templates/topics/topic.php?topicId=1003&ft=1&f=1003', 'rights_detail': {'base': 'http://www.npr.org/rss/rss.php?id=1003', 'type': 'text/plain', 'value': u'Copyright 2006 NPR - For Personal Use Only', 'language': None}}, 'status': 200, 'updated': (2006, 7, 24, 17, 53, 55, 0, 205, 0), 'version': 'rss20', 'encoding': 'us-ascii', 'bozo': 0, 'headers': {'content-length': '17980', 'set-cookie': 'v1st=1DCE87E4F229957A; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.npr.org, Apache=140.198.109.3.318941153763735423; path=/', 'accept-ranges': 'bytes', 'expires': 'Mon, 24 Jul 2006 17:55:35 GMT', 'server': 'Apache', 'last-modified': 'Mon, 24 Jul 2006 17:53:55 GMT', 'connection': 'close', 'etag': '"463c-44c50933"', 'cache-control': 'max-age=0', 'date': 'Mon, 24 Jul 2006 17:55:35 GMT', 'content-type': 'text/xml'}, 'etag': '"463c-44c50933"', 'href': 'http://www.npr.org/rss/rss.php?id=1003', 'namespaces': {'itunes': u'http://www.itunes.com/dtds/podcast-1.0.dtd', 'content': u'http://purl.org/rss/1.0/modules/content/', u'npr': u'http://www.npr.org/rss/'}, 'entries': [{'updated': u'Mon, 24 Jul 2006 11:09:00 EDT', 'updated_parsed': (2006, 7, 24, 15, 9, 0, 0, 205, 0), 'links': [{'href': u'http://www.npr.org/templates/stor
Re: [Zope] DB in Zope
En/na Alan ha escrit: Hi! I need a very simple DB in Zope, a table with 5 columns, less than 100 entries, to write, read and update, nothing else. Is Gadfly a serious option? Do l loose my database if Zope is restarted? Which other option, easy to use? A tutorial? Take a look at PropertyTools: http://iungo.org/products/PropertyTools HTH ___ 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 in Zope
Hi! I need a very simple DB in Zope, a table with 5 columns, less than 100 entries, to write, read and update, nothing else. Is Gadfly a serious option? Do l loose my database if Zope is restarted? Which other option, easy to use? A tutorial? Many thinks in advance. Cheers, Alan -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28<< ___ 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] Script execute with every request
Joshua Burvill wrote at 2006-7-24 14:01 +1000: > ... >Basically I just want to do an insert into a database of some stuff from >each request. Sounds like work for a "SiteAccess" "AccessRule"... -- 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] Re: Announcing the release of Zope version 2.8.8
Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Maciej Wiśniowski wrote: Zope 2.8.8 Released Is there a Windows version? Nope -- I can't build one. Chris Withers knows how, I think. I'm afraid I only do Zope 2.9 + as I don't have Visual Studio 6... Sidnei da Silva might be able to help... Chris PS: Sidnei: are you going to build the Windows installer for 2.9.4 or shall I? -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ 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] Script execute with every request
You have not mentioned what your use case is or what data you want to store, but another possible option would be to have every url call the same script; that script then logs/stores the desired information and then passes control (redirect or direct call) to the target routine (information about the target routine can be embedded within the url so that the initially invoked script can appropriately route control). Jonathan - Original Message - From: Joshua Burvill To: 'David H' Cc: zope@zope.org Sent: Monday, July 24, 2006 12:01 AM Subject: RE: [Zope] Script execute with every request Ok, so I could put a into my standard_html_header, and any redirects do them with a call to Dieters script (which may not work with future zope versions) to make sure I am keeping the original request. Hmm, is there a better solution anyone knows of? Basically I just want to do an insert into a database of some stuff from each request. Josh From: David H [mailto:[EMAIL PROTECTED] Sent: Wednesday, 19 July 2006 11:27 AMTo: Joshua BurvillCc: zope@zope.orgSubject: Re: [Zope] Script execute with every request Joshua Burvill wrote: Hi, I’d like to log certain parts of each request into a database table for every request to provide an audit trail. I thought of inserting a into the standard_html_header, but when there is a RESPONSE.redirect, it will not be the original request that gets logged. Can anyone offer any suggestions? Thanks, Josh Dieter wrote this http://www.dieter.handshake.de/pyprojects/zope/emulateRedirect.pyMaybe that helps. --No virus found in this incoming message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.1/391 - Release Date: 18/07/2006 --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.3/395 - Release Date: 21/07/2006 ___Zope maillist - Zope@zope.orghttp://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 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] Catalog aware
Lennart Regebro escribió: On 7/19/06, Garito <[EMAIL PROTECTED]> wrote: > Look at the CatalogAware mixin class. But with this class I could create a new class of PT Catalog aware, isn't it? Yup. I would like to convert a normal PT is this possible?' Yes, with monkeypatches, but really, you don't want to go that way. This feels to me as a case of you asking the question you THINK is the problem, because thats the problem you have right now. But often when that happens you have been running in the wrong direction for a while. It's like somebody asking how to break down a wall to get to the mall on the other side, when the best way to get to the wall is to get out of the dead-end street and then take left. :) So in short: Why on earth would you want page templates to be catalogaware? :) Sure but Is the cost so big? Yes. Ok, I'll rethink the question and try another aproach Thanks by now! (I'll ask you later if needed) -- Mis Cosas http://blogs.sistes.net/Garito ___ 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] Script execute with every request
Joshua Burvill wrote: Hi, I’d like to log certain parts of each request into a database table for every request to provide an audit trail. I thought of inserting a into the standard_html_header, but when there is a RESPONSE.redirect, it will not be the original request that gets logged. Well that would mean 2 log entries - one from the redirecting page and one from the target of the redirect. Btw, its usually not the best idea if you can avoid it - what about using the apache log facilities here? Can anyone offer any suggestions? Thanks, Josh -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/391 - Release Date: 18/07/2006 Ah, wasting cpu cycles for nothing :-) Regards Tino ___ 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 )