RE: [Zope-dev] DocumentLibrary 1.0b3 / Zope 2.4.2 (newbie?) problem
Hi, Are you using dtml-var ZopeTime().Date() instead of dtml-var _.ZopeTime().Date() ZopeTime I suspect doesn't come from the local namespace. Cheers, Paul Zwarts -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Kolb, Hap Sent: Friday, November 02, 2001 11:26 AM To: '[EMAIL PROTECTED]' Subject: [Zope-dev] DocumentLibrary 1.0b3 / Zope 2.4.2 (newbie?) problem Hi, any attempt to submit a document to my newly created document library under zope 2.4.2 yields the following error (traceback appended below): Error Type: NameError Error Value: global name 'ZopeTime' is not defined Now that's an error so basic that I suspect that it's me who is doing something wrong---if I only knew what...! Any help would be highly appreciated! Best, ...hap Traceback (innermost last): File /data1/software/Zope/zope-2.4.2/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /data1/software/Zope/zope-2.4.2/lib/python/ZPublisher/Publish.py, line 187, in publish File /data1/software/Zope/zope-2.4.2/lib/python/Zope/__init__.py, line 226, in zpublisher_exception_hook (Object: library) File /data1/software/Zope/zope-2.4.2/lib/python/ZPublisher/Publish.py, line 171, in publish File /data1/software/Zope/zope-2.4.2/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: document_submit) File /data1/software/Zope/zope-2.4.2/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: document_submit) File /data1/software/Zope/zope-2.4.2/lib/python/OFS/DTMLMethod.py, line 195, in __call__ (Object: document_submit) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_String.py , line 546, in __call__ (Object: document_submit) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_Try.py, line 212, in render File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_Try.py, line 221, in render_try_except File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_With.py, line 148, in render (Object: Documents) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_With.py, line 133, in render (Object: addDocumentFile(REQUEST)) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_Util.py, line 231, in eval (Object: addDocumentFile(REQUEST)) (Info: REQUEST) File string, line 2, in f File /data1/software/Zope/zope-2.4.2/Products/DocumentLibrary/DocumentStore.p y, line 355, in addDocumentFile (Object: Documents) File /data1/software/Zope/zope-2.4.2/lib/python/OFS/ObjectManager.py, line 324, in _setObject (Object: Documents) File /data1/software/Zope/zope-2.4.2/lib/python/Products/ZCatalog/CatalogAwar enes s.py, line 114, in manage_afterAdd (Object: 1004694129.27) File /data1/software/Zope/zope-2.4.2/lib/python/Products/ZCatalog/CatalogAwar enes s.py, line 184, in index_object (Object: 1004694129.27) File /data1/software/Zope/zope-2.4.2/Products/DocumentLibrary/CatalogPlus.py, line 122, in catalog_object File /data1/software/Zope/zope-2.4.2/lib/python/Products/ZCatalog/Catalog.py, line 382, in catalogObject File /data1/software/Zope/zope-2.4.2/lib/python/Products/ZCatalog/Catalog.py, line 495, in recordify File /data1/software/Zope/zope-2.4.2/lib/python/OFS/DTMLMethod.py, line 188, in __call__ (Object: date) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_String.py , line 546, in __call__ (Object: date) File /data1/software/Zope/zope-2.4.2/lib/python/DocumentTemplate/DT_Util.py, line 231, in eval (Object: ZopeTime().Date()) (Info: ZopeTime) File string, line 2, in f (Object: guarded_getattr) NameError: (see above) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] ZSQL methods lookup vars in REQUEST only (why?)
Hi Tim, Just to play devil's advocate; It seems this way, that methods pulling non-specifically from namespace could allow ways to modify the result if someone paid close attention to whats going on... i.e The total price of your shopping cart before its sent to the transaction broker. It requires the programmer to keep even more close care that all variables generated at runtime are first cleaned and wiped so that this same REQUEST couldn't just be anticipated by someone who's interested. Or can you suggest a way around this? Thanks, Paul Zwarts -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Tim McLaughlin Sent: Thursday, October 11, 2001 1:30 PM To: [EMAIL PROTECTED] Cc: Micah Martin Subject: [Zope-dev] ZSQL methods lookup vars in REQUEST only (why?) I've been asked too many times now by developers what is wrong when they call ZSQL Methods without passing parameters because their parameters are in the namespace. This seems to make sense to all new Zopers (and some older ones like myself) because all other DTML lookups are in the entire namespace. Anyway, I propose that ZSQLMethods change and do variable lookups in the entire namespace, not just the REQUEST object. It seems to be a simple enough change (at least it looks it) and I can submit the patches, but the harder thing is to get people to agree that it is a change for the better. The only argument that I have heard against it is that variables will be found mysteriously through the stack and that this is harder to understand. However, that just makes it inconsistent with all other DTML and therefore mysterious in its own way. Consistency is much better for learning and for remembering, and DTML in ZSQL should work the same as DTML in DTML Methods, etc. Please consider this and abuse me as appropriate ;) Regards, Tim -- Tim McLaughlin iterationZERO - www.iterationzero.com 703.481.2233 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] ZSQL methods lookup vars in REQUEST only (why?)
I figured that I could be relatively safe by using heavy sessioning. First I started with SQLSession, and now CST... Tips I do: 1) Create all formbased applications by folders. In otherwords /folder/Support is actually the folder and you always put the root logic into index_html 2) The index_html is the control base, that will call in methods which are your forms. (This way crawlers see a directory with only 1 page (methods are hidden AFAIK)) I always split the application into a minimum of 4 pieces (index_html, form, validation form, output). For multi-stage forms like a shop, the number is sitting around 10. 3) Split all forms OUT into theses methods, but DON'T put the form tags in that method. Keep them in the index_html so you cannot go directly to a single page other than index_html and be able to submit. It basically fragments everything to be unuseable by itself. 4) I use CoreSessionTracking VERY heavily. Using a skin based concept, every pageload executes a sessionlogic method, which does switching. For instance, when any kind of form is submitted, I set a sessionvariable called ACTION to a value like 'check'. Then the index_html is sensitive to this change, and will process the form ONLY if the form was submitted through the whole process properly. I also use this validation technique to check forms and feedback incompletenesss. If youre carefull, the session variables cannot be modified outside of the process flow so you ensure nothing funky is going on. 5) For things like my shop, prices are always checked and modified in the ZSQL method itself. In other words, I use dtml inside the ZSQL method to enforce cascade SQL calls. Like when a customer requests the price of a product and decides to buy it, the price is stored in hidden fields on the html page, but it doesn't make a differene, becausse at runtime, the ZSQL ethod does a second redundant retrieve when adding the record, so the price value ALWAYS is what it should be and cant be changed by any hack (short mucking with the code) Its totally obvious the pure python would be good instead, but I'm not very good at it yet, and can crank out dmtl much faster. Just some tips if anyone's interested... Paul Zwarts -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Toby Dickenson Sent: Thursday, October 11, 2001 2:43 PM To: [EMAIL PROTECTED] Cc: Paul Zwarts; [EMAIL PROTECTED] Subject: Re: [Zope-dev] ZSQL methods lookup vars in REQUEST only (why?) Anyway, I propose that ZSQLMethods change and do variable lookups in the entire namespace, not just the REQUEST object. It seems to be a simple enough change (at least it looks it) and I can submit the patches, but the harder thing is to get people to agree that it is a change for the better. Paul Zwarts wrote: Just to play devil's advocate; It seems this way, that methods pulling non-specifically from namespace could allow ways to modify the result if someone paid close attention to whats going on... Exactly right. Even the guys at Zope.com dont pay close enough attention... Historically this has been the source of several security holes. Tim wrote: I agree. However, this is true of all DTML. That is true, and is the reason why dtml is inappropriate for any use except trivial document templating. In other uses it is either buggy (for the reason Paul mentioned) or very very ugly (because the author knows about the potential bugs, and in dtml it is cumbersome to work round them). It is a pity that the current zope-newbie documentation presents dtml as more than it is; as an essential part of the zope way. Anyway, there are plenty of alternatives to those non-trivial uses of dtml; Python Scripts, python products, CMF skins, etc. None of them are quite as slick, but at least they work. I dont know of a good alternative to SQLMethods, so I would prefer that they not be 'broken' in order to maintain consistency with a feature that many people recommend you should avoid. Tim also wrote: The only argument that I have heard against it is that variables will be found mysteriously through the stack and that this is harder to understand. However, that just makes it inconsistent with all other DTML and therefore mysterious in its own way. You are right that the mechanism for calling SQLMethods from DTML is different to calling DTML from DTML, but the odd one out is DTML calling DTML! DTML calling a SQLMethod current behaves the same as DTML calling PythonScript, pure python functions, extension class functions, or an external method. Toby Dickenson [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist
RE: [Zope-dev] Curiously Zope Hanging
I've had this problem as well, although I changed from ZPopPy to psycopg0.99.4 which solved the problem. What I found in REdhat Linux 7.1, where the ps -ef command now queries more info from its children, I finally saw the status of my dbms threads. The Zope hanging maybe wasnt zope directly. It still translated requests BUT I saw in ps -ef: postgresql db01 UPDATE waiting. This is where the hang is. Several emails from Dieter just confused me more. Something about Zope not having imlicit commits on transactions, so you had to make sure a dtml-call transaction().commit() was placed somehwere. This seemed to solve some problems at the time for me although I got alot of : Warning: COMMIT, No transacion in progress Hope I confused you a bit more. Maybe we can get somewhere eventaully ;_) Paz -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Andre Schubert Sent: Thursday, July 12, 2001 2:48 PM To: [EMAIL PROTECTED] Cc: zope Subject: Re: [Zope-dev] Curiously Zope Hanging Hi Steve, Immunix Redhat 6.2 Zope 2.3.3 Postgres 7.1.2 I'am running Zope with -M -D and with Stupid_log_file. But i don't find a problem. When Zope hangs, then there is one Thread Running and if i trace this Thread nothing happens. as Steve Spicklemire schrieb: Hi Andre, What OS? I've had lots of trouble with Postgres and threads on FreeBSD. Have you tried starting Zope with '-D' to see if threads are an issue? -steve Andre Schubert wrote: Hi all, I have a problem with my Zope, he hangs unexpectly if i view a special Method which generates Diagrams with data from a PostgresDB. The data are selected by a timespan( default is 24 Hours ). The Method works as descripted bellow: First when i call foo, then the HTML-Code is rendered with some images-tags, which are generated by selects. The image tags are calling the method foo which returns image data. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:05 everything works fine. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:10 Zope hangs, no exception no log entry, Zope only hangs. If i want my diagrams from 2001-06-01 5:05 to 2001-06-01 12:10 which is the same timespan as example 1 Zope hangs too, no exception no log entry, Zope only hangs. If i view the postgres logs the nothing happens. Could anyone help me to find the problem or the place Zope is hanging thanks as P.S.: Exact the same problem occurs when i you another PostgresDA ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Curiously Zope Hanging
Yes, thanks for mentioning that Frederico. I _should_ have said thats what I used in PoPy. I dont use it anymore with your product. : ), but that doesnt mean I'm any wiser for this. But *magic* is a highly used term in programming these days, so I'm not worried too much. At least I dont have unhappy customers anymore. Paz -Original Message- From: Federico Di Gregorio [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 3:30 PM To: Paul Zwarts Cc: Andre Schubert; [EMAIL PROTECTED]; zope Subject: RE: [Zope-dev] Curiously Zope Hanging On 12 Jul 2001 15:20:16 +0200, Paul Zwarts wrote: I've had this problem as well, although I changed from ZPopPy to psycopg0.99.4 which solved the problem. What I found in REdhat Linux 7.1, where the ps -ef command now queries more info from its children, I finally saw the status of my dbms threads. The Zope hanging maybe wasnt zope directly. It still translated requests BUT I saw in ps -ef: postgresql db01 UPDATE waiting. This is where the hang is. Several emails from Dieter just confused me more. Something about Zope not having imlicit commits on transactions, so you had to make sure a dtml-call transaction().commit() was placed somehwere. This seemed to solve some problems at the time for me although I got alot of : Warning: COMMIT, No transacion in progress never, never, never do that with psycopg. psycopg cooperates with zope (that *does* commit on transactions) and has real transaction control. with zope+psycopg you'll get a commit (or abort) just at the end of the requested page. ciao, federico -- Federico Di Gregorio MIXAD LIVE Chief of Research Technology [EMAIL PROTECTED] Debian GNU/Linux Developer Italian Press Contact[EMAIL PROTECTED] All'inizio ho scritto un programma proprietario, in esclusiva per il cliente; e mi ha succhiato un pezzo di anima. -- Alessandro Rubini ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Curiously Zope Hanging
Ah, the common paradigm. someone TOLD me that smoking cigarettes wiht ceral and milk will make me barf, and I can assume that to be so. But when i do indeed barf, do I come satisfied with that or now question if that it had to do with te spoon or the bowl? Paz -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Steve Spicklemire Sent: Thursday, July 12, 2001 4:17 PM To: Andre Schubert Cc: zope Subject: Re: [Zope-dev] Curiously Zope Hanging Hi Andre, Andre Schubert wrote: No, the problem is not reproduceable, because if move the timespan 5 minutes earlier then Zope crashes. And thats the problem. Hmm.. my point was only that if you can *predict* correctly when Zope will hang.. then it is at least 'reproducable'. If i call my diagrams in the order that a is the same and b is changing everything works well and there are absolutely no hangs, but if i call my diagrams the other way that a is changing and b is the same then Zope works if i select data from 2001-06-01 5:00 to 2001-06-20 12:05 and Zope hangs if i select data from 2001-06-01 5:00 to 2001-06-20 12:10 or from 2001-06-01 5:05 to 2001-06-20 12:10 I hope you understand my explanations in my bad german-english. I think I get the basic picture... but as Steve Spicklemire schrieb: Well, the good news is you have a reproducable symptom! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )