[Zope3-Users] PsycopgDA problem
I have problems getting my Postgres database connection to work. I am using FreeBSD and have installed psycopg-1.1.21 via ports. PsycopgDA I got from the zope svn (svn://svn.zope.org/repos/main/psycopgda/trunk). The Zope version is 3.2.0. I followed the README.txt file and have the database adapter added and active (was that by default). When I try a simple SQL query on the test page, I get a ForbiddenAttribute exception (see below for trace). Any idea how I can fix this? Traceback x-tad-biggerTraceback (innermost last): Module zope.publisher.publish, line 138, in publish result = publication.callObject(request, object) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 113, in mapply return debug_call(object, args) - __traceback_info__: security proxied zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/local/www/Zope-3.2.0/lib/python/zope/app/rdb/browser/rdbtestresults.pt instance at 0xb0218ec> Module zope.publisher.publish, line 119, in debug_call return object(*args) Module zope.app.pagetemplate.simpleviewclass, line 44, in __call__ return self.index(*args, **kw) Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__ return self.im_func(im_self, *args, **kw) 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 277, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 908, in do_useMacro self.interpret(macro) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 538, in do_optTag_tal self.do_optTag(stuff) Module zope.tal.talinterpreter, line 523, in do_optTag return self.no_tag(start, program) Module zope.tal.talinterpreter, line 518, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 878, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 976, in do_defineSlot self.interpret(block) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 966, in do_defineSlot self.interpret(slot) Module zope.tal.talinterpreter, line 352, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 588, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) Module zope.tales.tales, line 696, in evaluate return expression(self) - /usr/local/www/Zope-3.2.0/lib/python/zope/app/rdb/browser/rdbtestresults.pt - Line 15, Column 2 - Expression: PathExpr standard:u'view/getTestResults'> - Names: {'args': (), 'context': psycopgda.adapter.PsycopgAdapter object at 0x95e4f6c>, 'default': object object at 0x815c538>, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL=http://82.182.101.160:/++etc++site/tools/pgdb/test.html>, 'template': zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 0x9fabf6c>, 'usage': zope.pagetemplate.pagetemplate.TemplateUsage object at 0xb00d34c>, 'view': zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/local/www/Zope-3.2.0/lib/python/zope/app/rdb/browser/rdbtestresults.pt object at 0xb0218ec>, 'views': zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xaee4f4c>} Module zope.tales.expressions, line 205, in __call__ return self._eval(econtext) Module zope.tales.expressions, line 199, in _eval return ob() Module zope.app.rdb.browser.rdb, line 27, in getTestResults result = queryForResults(self.context(), sql) Module zope.app.rdb, line 401, in queryForResults cursor = conn.cursor() ForbiddenAttribute: ('cursor', psycopgda.adapter.PsycopgConnection object at 0xaede1cc>) /x-tad-bigger___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: redirects in a formlib EditForm
Gary Poster wrote: On Feb 26, 2006, at 4:17 PM, jürgen Kartnaller wrote: Joel Moxley wrote: ** What is the best way to use a formlib EditForm to redirect a user after applying changes without fully cloning a handle_edit_action method? ** I'm doing it this way : def render(self): if self.errors is None or self.errors: return super(EditPerson, self).render() self.request.response.redirect('..') Jürgen Thanks Jürgen! That works perfectly for me. Looking one step forward, I would like to redirect the user back to the previous page from whence they came (without using sessions). I figure I am going to need to stash that value on my EditForm class and then pull it up during the redirect in my render method. I've done my best to explore this, but I can't figure out where the previous page information will be available on my EditForm. ** Where should I stash previous page information for future redirects on my EditForm? ** That's also an unsolved use case I have. The 'default' template of 'FormBase' contains the slot 'extra_info' which could be filled with some hidden input fields. I defined a new template for my own EditForm. But now I would like to use the existing template in formlib 'pageform.pt' and fill the slot but don't know how. Is this a possible way and the right way ? How can I use the existing template ? It must be useable with metal:use-macro somehow. Yes, we write custom templates that use hidden input fields. We reuse the existing template by putting the default template on another attribute of the view class, and then saying 'metal:use-macro=view/...' For instance class MyForm(zope.formlib.form.EditForm): base_template = zope.formlib.form.EditForm.template template = (...a named template if you want, or just a page template directly...) Then in your template, you can refer to macros in the original like this: 'metal:use-macro=view/base_template/macros/extra_info' Thanks a lot for this. The above metal statement doesn't work, I do it this way : metal:use-macro=view/base_template/macros/main and then metal:fill-slot=extra_info Jürgen -- --- Jürgen Kartnaller mailto:juergen_at_kartnaller.at http://www.kartnaller.at http://www.mcb-bregenz.at --- ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: redirects in a formlib EditForm
On Feb 27, 2006, at 6:52 AM, jürgen Kartnaller wrote: Gary Poster wrote: [...] Yes, we write custom templates that use hidden input fields. We reuse the existing template by putting the default template on another attribute of the view class, and then saying 'metal:use- macro=view/...' For instance class MyForm(zope.formlib.form.EditForm): base_template = zope.formlib.form.EditForm.template template = (...a named template if you want, or just a page template directly...) Then in your template, you can refer to macros in the original like this: 'metal:use-macro=view/base_template/macros/extra_info' Thanks a lot for this. The above metal statement doesn't work, I do it this way : metal:use-macro=view/base_template/macros/main and then metal:fill-slot=extra_info Heh, yeah. Thanks for clarifying. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Problem with the Zope3 book Example (Can't Browse Interface in Zope 3.2)
Hi all, I recently bought the Web component Devlopment with Zope3 book and downloaded the worldcookery example. I tried to deploy the example (chapter 5) into my Zope 3.2 instance and restarted it. The book says that I should click on Manage Site and go to Site Management where I will see a Browse Interfaces option, but I couldn't find any such 'Browse Interfaces' tab. Is this not present in Zope 3.2 or is my Zope instance not showing the IRecipe interface. To deploy the example, I moved it to my instances' python/lib/worldcookery and added the worldcookery-configure.zcml into etc/package-includes. Please let me know if anyone is facing similar problems with this example in Zope 3.2. Thanks, Sid. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with the Zope3 book Example (Can't Browse Interface in Zope 3.2)
Dnia poniedziałek 27 lutego 2006 16:09, Siddhartha Azad napisał: Please let me know if anyone is facing similar problems with this example in Zope 3.2. You're not alone. The same thing here (Zope 3.2, linux) - I've spotted that yesterday and was not able to find why there is no Browse Interfaces tab :(. So thanks for your post, and I hope that someone will give an answer to us :). -- eXt ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with the Zope3 book Example (Can't Browse Interface in Zope 3.2)
Siddhartha Azad wrote: Hi all, I recently bought the Web component Devlopment with Zope3 book and downloaded the worldcookery example. I tried to deploy the example (chapter 5) into my Zope 3.2 instance and restarted it. The book says that I should click on Manage Site and go to Site Management where I will see a Browse Interfaces option, but I couldn't find any such 'Browse Interfaces' tab. Is this not present in Zope 3.2 or is my Zope instance not showing the IRecipe interface. To deploy the example, I moved it to my instances' python/lib/worldcookery and added the worldcookery-configure.zcml into etc/package-includes. Please let me know if anyone is facing similar problems with this example in Zope 3.2. Thanks, Sid. Hi Sid, My answers are often flawed but I'll plow on anyway. Philipp's book is great, and I found it pleasant to digest - there have been plenty of changes since its publication though... AFAIK there is no longer a Browse Interfaces tab... The route I've been using to get to this information varies a little but: In your case - point your browser at http://host:port/++apidoc++ This is an invaluable resource! From the top left panel choose Interface Types then in the bottom right expand IContentType, if all's well you should find IRecipe in there. Once you've added a Recipe object to the ZODB you can more quickly find this kind of information by visiting the object in your browser and choosing its Introspector tab. Hope this is of some use. Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] introductory app idea: music filesystem browser
I would add ZPT, skins and increasingly formlib to the list of things to learn. +1 on demos vs. tutorials. A good working demo functions as both a tutorial and a testimonial. I think right off the bat, the bookmarker app should be incrementally expanded. Evolving the app *is* the power of Zope3. Other apps that start off easy but can grow increasinly complex fast. * blog * wiki I've been wanting to put together a Concept Map companion to the Bookmarker tutorial. If anyone is interested in helping out please give me a buzz, and I'll setup a collaborative concept map. Roman Susi wrote: Joel Moxley wrote: On 2/26/06, Roman Susi [EMAIL PROTECTED] wrote: Hi joel, ... Probably such a simple app doesn't require more than 2 hours from seasoned Zope3 developer ;-) Regards, Roman I think you're right. I rethought what an intro app should be, and I think the bookmarker one gets the job done. The one drawback for the bookmarker is that there's not documentation on taking it deeper and making it do more. Another idea I had would be to take the worldcookery app straight from the example code chapter 5 or 6 and provide a streamlined do this in 30 min introduction. Then if someone wanted to go deeper into what they had done or go farther and add more features, philikon's book would be right there. The obvious drawback would be the lack of 3.1 and 3.2 specific features. In any event, I think a well-conceived official getting started guide would carry much weight in that crucial time when someone would be looking around at various frameworks like ror and django. There are some decent guides out there, and I am curious to see what the consensus would be. Yes... Zope 3 looks heavy-weight and complicated - not for everyone. And even non-everyone has hard time. Even Karrigell: http://karrigell.sourceforge.net/ sells better to Python programmer with its def index(): print Hello, world ! thing. (Cf. Zope3 Hello World) So, good tutorials and examplar application could help. The problem with current Zope3 material is... lack of motivation. To deal with Zope3 you need to master these concepts: - views - layers - resources - viewlets - content objects - schemas - utilities - services - site - interfaces - adapters - principals - tests - ZCML configuration (have I forgot anything?) And you need to RTFM a lot! And then spend a lot of time writing IHelloWorld, configure.zcml, permissions, etc. around simple thing: def index(self): return Hello, world ! So, examplar app should show WHY do I want all this. Then Zope3 will be ready to accept Wows! and attract people who go to Ruby railstation or whatever. And I want to know HOW the power of Python is useful inside Zope3. By the impression (first and second) I see no reason why Zope3 is done in Python and not in Java or Cobol. Probably, several apps/components are required to show the best of Zope3. For example, PythonCard has (and always had) a lot of small demos which REALLY demonstrate why using PythonCard is easier than just plain wxWindows / wxWidgets. And those demos are small because using PythonCard framework made applications small. Maybe SQLObject can be used to make things more compact. (BTW, I think that ZODBObject for ZODB could be a far more plus. Yes, I know ZODBObject is just Persistent object in Zope, but how do I make this with ZODB as easy as: class Person(SQLObject): ... addresses = MultipleJoin('Address') ? That is, quering ZODB is difficult (it's probably a problem of any OODB, but nonetheless). ) To summarize, are there any demo apps which make people jump with joy? I do not believe Zope3 is difficult because its serious framework. Frameworks are there to subtract complexity, not add. And demos are just for that: to show cases where complexity is reduced. Please note, that I changed discussion from tutorial to demo. This is because I believe that good demo is also good tutorial. Regards, Roman Suzi ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users -- View this message in context: http://www.nabble.com/introductory-app-idea%3A-music-filesystem-browser-t1162019.html#a3156058 Sent from the Zope3 - users forum at Nabble.com. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: redirects in a formlib EditForm
On Feb 27, 2006, at 8:39 PM, Joel Moxley wrote: Damn, I still can't get this working right after following all of the instructions here. I can successfully stash the refering url in a hidden form, but it's not showing up in my request. I can think of two possible things. One is that you are maybe getting a form validation error and then pressing Apply, or that you are using a widget that redraws the screen. Another is that we might have a bug that makes form variables be stomped on by header names. :-( First try changing def referer(self): return self.request.getHeader('HTTP_REFERER') to def referer(self): return self.request.form.get('HTTP_REFERER') or self.request.getHeader('HTTP_REFERER') Then if that doesn't work, try changing it to def referer(self): return self.request.form.get('referrer') or self.request.getHeader('HTTP_REFERER') and changing your template to have input type=hidden name=referrer value= tal:attributes=value view/referer / (Sadly, the spec made a spelling error with referer. :-) ) By the way, my svn update had a conflict at src/zope/interface/common/. I deleted the old one and it worked fine, but I guess I'll note it here. Yeah, they are rearranging things at PyCon. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zodb objects backup
Shaun Cutts wrote: So far so good, modulo the replication issue. (We don't have much funding yet... but if initial launch goes well, we're hopeful :)). As people have mentioned, you can use repozo to get almost the same effect. Either that or do app-level replication ;-) It would be very nice if there were a faq or other doc addressing all of these scalability-related questions systematically for someone like me who understands what a relational database is doing for them (in return for squashing all their objects). It seems I'm not the only one with these concerns. :) Welcome to Open Source, we look forward to seeing your newly-written faq as it becomes available online ;-) In the meantime, I had an idea about my current implementation: maybe instead of __getstate__ and __setstate__ I should put the external data in _v_data (marking as volatile). Then I could trap for its existence, and load if necessary; and also have an explicit refresh wired to a button in the GUI. Yup, this is exactly what _v_ was designed for... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users