Re: [Zope] Zope and wxPython interface
Lumír Jasiok wrote: > David Bear wrote: >> What do you gain by doing this? >> >> On Wed, Aug 12, 2009 at 2:50 PM, Lumir Jasiok > <mailto:lumir.jas...@vsb.cz>> wrote: >> >> Hi, >> >> I need to write an application which will be based on MVC design and >> will have both web interface and desktop GUI based on wxPython. It is >> possible to write such an application as standard Zope app and use >> zope.interfaces package for defining wxPython GUI as other view >> (I hope >> that it's called view, I am not sure - I am new in Zope >> programming)? Or >> am I totally wrong? >> >> Best Regards >> >> Lumir Jasiok >> >> -- >> Lumír Jasiok >> VSB-TU Ostrava - Computer centre >> Tel: +420 59 732 3189 >> E-mail: lumir.jas...@vsb.cz <mailto:lumir.jas...@vsb.cz> >> http://www.vsb.cz >> >> >> > I want to have an application with common code for both web and > desktop application, so data and business logic will be common and > only thing which will be different will be a view (web page or desktop > application GUI). So users will have choice what interface they want > to use, data will be same. > > As programmer I want to have common code for business logic, because > of simplicity. I don't want to have two trunks, two business logics etc. > Hi, Lumir You might take a look at pyjamas (http://pyjs.org). Using pyjamas, you can have common code for business logic and also for the GUI on web and desktop. The main data transfer/persistence mechanism in pyjamas is JSON-RPC, so that part of the model can be zope or anything that can do JSON-RPC. If you like wxPython GUI code, pyjamas code is very similar, and there are examples using PureMVC (http://puremvc.org) in the repository. You cannot, at present, use zope.interface to do automatic widget generation in pyjamas. On the other hand, it is really easy to do custom widgets and client-side display logic. You write your widgets and their behavior in python, not in HTML and javascript. Styling, however, can be done with css. In the eight months since I first experimented with pyjamas (http://www.mail-archive.com/zope@zope.org/msg31618.html), it has improved substantially. Fewer gotchas. More joy. Worth a look. - Jim Washington ___ 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] Experiment: Pyjamas with Zope
Quick note. I found that The "fix pyjamas" question in my previous note could be handled with a ~100 line python module that makes a new class descending from pyjamas.HTTPRequest.HTTPRequest, but overriding asyncPostImpl with a supported content-type, e.g., "application/json". The module is mostly copy-paste from pyjamas.JSONService and pyjamas.HTTPRequest, but I'll provide it to anyone interested. It was really simple to do. Kudos to pyjamas for making fixes easy. - Jim Washington ___ 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] Experiment: Pyjamas with Zope
So, I have a need to put together a more elaborate web page. Lots of pop-up dialog boxes and dynamically-updated choice lists. How to do that? I take a look at Pyjamas http://pyjs.org. Pretty cool. Here's the theory. Write fancy application web page in python using the Pyjamas/GWT API, then "compile" it to javascript. Serve it through zope, which will handle auth/auth. Client-server communication flows through json-rpc calls. What could possibly go wrong? First-off, just a simple test-of-concept. Edit the JSONRPCExample.py file in the examples/jsonrpc folder that came with pyjamas. I'll locate the jsonrpc service in zope's containment root, so I change the uri in EchoServicePython from "/services/EchoService.py" to "/". That's all I need to change. Compile it using the handy "build.sh" that's in the same folder. Look in the "output" folder and see what we got. Wow. a bunch of files. JSONRPCExample.IE6.cache.html Mozilla.cache.html OldMoz.cache.html Opera.cache.html Safari.cache.html JSONRPCExample.html JSONRPCExample.nocache.html corner_dialog_bottomleft.png corner_dialog_bottomleft_black.png corner_dialog_bottomright.png corner_dialog_bottomright_black.png corner_dialog_edge.png corner_dialog_edge_black.png corner_dialog_topleft.png corner_dialog_topleft_black.png corner_dialog_topright.png corner_dialog_topright_black.png history.html pygwt.js tree_closed.gif tree_open.gif tree_white.gif I'm lazy, so instead of doing a bunch of resource or view directives in ZCML, I let my paste.ini do the handling. [app:pyjs1] use=egg:Paste#static document_root=/home/jwashin/projects/pyjamas/pyjamas-0.4/examples/jsonrpc/output then, I link that in with the composite app. [composite:Paste.Main] use = egg:Paste#urlmap / = zope /images = images /pyjs1 = pyjs1 Now, to get to JSONRPCExample.html, I need to go to http://website/pyjs1/JSONRPCExample.html But first, I need to actually handle the json-rpc requests in zope. Make a servicetest.py. Almost exactly similar to EchoService.py in the output/services folder. from zif.jsonserver.jsonrpc import MethodPublisher class Services(MethodPublisher): def echo(self, msg): return msg def reverse(self, msg): return msg[::-1] def uppercase(self, msg): return msg.upper() def lowercase(self, msg): return msg.lower() Now, a ZCML incantation. Start zope, and go to http://website/pyjs1/JSONRPCExample.html Nice page. Click the "Send to Python Service" button. Server Error or Invalid Response: ERROR 0 - Server Error or Invalid Response Damn. Pull up tcpwatch and see what we are getting. Aha. pyjamas app is sending jsonrpc with a content-type of application/x-www-form-urlencoded, so zope is not handing it off to zif.jsonserver for handling. Fix pyjamas or let zif.jsonserver handle this content-type? In zif.jsonserver's configure.zcml, in the "publisher" directive, add application/x-www-form-urlencoded to mimetypes. Restart zope. Go to http://website/pyjs1/JSONRPCExample.html It works. Change permissions in the jsonrpc:view directive. Restart zope. Go to the page. Page loads. Push the button, and I get a Basic HTTP Authentication dialog. Nice. Overall Results: So far, so good. :) - Jim Washington ___ 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] zip files corrupted with IE when opened, fine when downloaded
Jim Washington wrote: robert rottermann wrote: Hi there, we have a problem with an intranet that runs using plone 2.5.3 when users using IE want to open a zip file from the intranet by using the "open" option from the download dialog they get winzip complaining that the file is corrupted. if they select "save" from the same dialog they can open the zip archive without problem. does anyone know a solution for this or give me an idea where to look for one? I had a similar problem with pdf files, and googling indicated that IE might be deleting the cached copy of the document before the opening application can get to it. I have had some success setting cache control to "private". Something like: request.response.setHeader('cache-control','private') "private,must-revalidate" may also be a good value, depending on your situation. I Googled back through and found that the problem usually manifests when you have a 'cache-control':'no-cache' header. The above explanation was not quite right. Anyway, either removing the "no-cache" header or using one that allows the local machine to keep a copy should work, if the problem is in fact a 'no-cache' header. - Jim Washington ___ 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] zip files corrupted with IE when opened, fine when downloaded
robert rottermann wrote: Hi there, we have a problem with an intranet that runs using plone 2.5.3 when users using IE want to open a zip file from the intranet by using the "open" option from the download dialog they get winzip complaining that the file is corrupted. if they select "save" from the same dialog they can open the zip archive without problem. does anyone know a solution for this or give me an idea where to look for one? I had a similar problem with pdf files, and googling indicated that IE might be deleting the cached copy of the document before the opening application can get to it. I have had some success setting cache control to "private". Something like: request.response.setHeader('cache-control','private') "private,must-revalidate" may also be a good value, depending on your situation. It's worth a try... - Jim Washington ___ 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] ANNOUNCE: zif.sedna-0.9beta
The Zif Collective is proud to announce yet another confusing option for your applications. Sedna is a "native" XML database, open source, licensed under Apache 2.0 license. See http://modis.ispras.ru/sedna/ for features and download. zif.sedna communicates with Sedna. zif.sedna provides a dbapi-like interface (connections and cursors). zif.sedna provides a zope(3) database adapter and connection pooling (thanks to some code from sqlalchemy). It is provisionally thread-safe. zif.sedna is pure python. XQuery can be cool. zif.sedna is now available at the cheese shop. http://pypi.python.org/pypi/ The readme came out a bit funny there. I know there were some < and > in the document when I wrote it, so you will have to use your imagination a bit to read the blurb. Or easy_install it and read the docs as they were intended. -Jim Washington ___ 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] suddenly confused
David Bear wrote: > I'm doing my first zeo setup, and suddenly I'm not sure about my > products directory. Do I put all products in a products directory of > the zeo server or in each zope instance? > > IIRC, Products go in each zope instance. The zeo instance gets the ZODB. -Jim Washington ___ 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] Import Modules
Luiz Fernando B. Ribeiro wrote: > Hello, > > I manage my own servers developing web applications and I would like > to remove the import restrictions of python modules in python scripts. > Is it possible? How can I allow other modules to be imported? I have > been using external modules but it is starting to become nonproductive > since I have to create functions to simple problems like md5, re, etc, > and just using the needed modules would be much simple. > > I use Zope as an application server and my clients do not have access > to the ZMI, so I'm not concerned with protection against misuse by my > clients. > > Thanks in advance, > I recall seeing some documentation about this use case somewhere. I think it was in the folder with the python scripts product. -Jim Washington ___ 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] AJAX and Zope
Lennart Regebro wrote: On 5/24/06, Pascal Peregrina <[EMAIL PROTECTED]> wrote: By Zope objects I meant: You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication. That is a macro call. There is no difference. It just that the macro includes the HTML needed to suck in the JS library you use. I have been working on a simple WSGI middleware filter that handles js library insertion pretty well, without complicated macros that assure that a javascript library gets included only once. It works by creating a WSGI environ variable for desired includes. Individual widgets ask a utility to register their need for a particular javascript or css resource into that environ variable. After Zope is finished generating the page, the middleware inserts the appropriate
Re: [Zope] REMOTE_USER Security Issue
Lennart Regebro wrote: On 5/18/06, Jim Washington <[EMAIL PROTECTED]> wrote: Completely immutable environ is not a good choice from WSGI point-of-view. environ can be useful for middleware information-passing. WSGI middleware would by definition get the environ and be able to modify it before the request gets it, so that isn't a problem. Yes, not a problem for for middleware -> app communication. But some app -> middleware communication would be impossible if environ is completely read-only. I am assuming that "immutable" here means "read-only". What if a middleware app puts a key in environ specifically for the app to write e.g., post-processing parameters? I have a use case for that. -Jim Washington ___ 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] REMOTE_USER Security Issue
Cliff Ford wrote: This is just to report that this issue is resolved (for me). Tres Seaver kindly provided a patch for HTTPRequest.py that makes the environ dictionary immutable (appended below for those in a similar position). This may have adverse consequences for applications that rely on existing behaviour and Tres has recommended that it would be better to harden the User Folder code. In our case we might also be able to encrypt the remote Username. Once again, thanks to Tres and other list members, who are a wonderful resource. Completely immutable environ is not a good choice from WSGI point-of-view. environ can be useful for middleware information-passing. -Jim Washington ___ 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] Some installation glitches
Andrew Sawyers wrote: I'm running Suse 10 - and I've got both /usr/lib and /usr/lib64 I don't believe that dependency has anything to do with Zope. If I take the zope distribution tarball and do the configure, make, make install dance, I get a 'lib64' directory inside the Zope installation instead of a 'lib' directory. mkzopeinstance has trouble with that configuration. It needs a 'lib' directory instead of a 'lib64' directory, so mkzopeinstance fails unless I do something, like symlinking lib64 to lib. -Jim Washington ___ 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] Some installation glitches
Andrew Sawyers wrote: I've not experienced any build problems running on 64bit machines. I've got a 64bit laptop and 64bit dev desktop machine, not to mention all our production servers are 64bit as well. I've seen the same lib/lib64 problem in Gentoo Linux on Zope 3. To work-around the problem, I make a symlink from lib to lib64 after install, and things work OK. -Jim Washington ___ 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: Re: ZAjax anyone?
Greg Fischer wrote: Ah even better! Thanks guys. I was going to reply just to mention I have a "not as cool" way of using Zope with Ajax at my site now too. www.zajax.net <http://www.zajax.net/> Seems every rock I turn over, I find 3 others worth investigating. Lots of cool stuff going on out there. I put up my own demo, but it's not nearly the prefered way of doing things by most people. I myself, prefer DTML over ZPT, so my demo is based on that. I also am using one of the larger client frameworks available, Dojo Toolkit. The js file is around 130k if I remember. The smaller ones are great and do the job, but I wanted something larger and more widely used like Dojo to build off of. I know eventually I'll look at the JSON stuff too. Sound interesting. Hi, Greg Cool! I like the way you do the how-to. Do you plan similar how-tos for other JS libraries/techniques? Would you accept contributions? I find myself looking at mochikit (http://mochikit.com) occasionally. In its ajax-tables demo, it uses a tal(esque) syntax for dom manipulation in client javascript, which could be interesting for fans of page templates. For the future, dare I ask, maybe some zope3 stuff? I think the zope community really needs zope-oriented how-tos and evaluations of the various AJAX libraries. zajax.net has the right name to be a prime focus of such activities, should you be willing to do that. Thanks! -Jim Washington ___ 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] how dump Zope database content into a file system directory tree?
[EMAIL PROTECTED] wrote: Possible to dump content in Zope database into a file system tree? Yes. http://www.zope.org/Members/tseaver/FSDump --Jim Washington ___ 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] Puzzling Import/Export problem
A friend in Russia is still using my old ZClasses QSurvey product. He is attempting to copy an installation from one machine to another, and upgrade Zope to 2.6.4. Exporting the product and instances works fine, but some object instances will not import correctly. A product instance is a folderish object that contains other objects. One particular folderish subobject will not import correctly; all the others import fine. The .zexp of the entire product instance, with subitems, etc., imports OK, but the one folderish object shows up as "broken" in the ZMI. Exporting that object as XML and reimporting after correcting the appropriate class ID string results in a "BadPickleGet" error 7. 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.ObjectManager, line 561, in manage_importObject Module OFS.ObjectManager, line 578, in _importObjectFromFile Module ZODB.ExportImport, line 65, in importFile Module OFS.XMLExportImport, line 119, in importXML Module ZODB.ExportImport, line 75, in importFile Module transaction._transaction, line 368, in commit Module transaction._transaction, line 297, in savepoint Module transaction._transaction, line 294, in savepoint Module transaction._transaction, line 656, in __init__ Module ZODB.Connection, line 1034, in savepoint Module ZODB.Connection, line 470, in _commit Module ZODB.ExportImport, line 140, in _importDuringCommit BadPickleGet: 7 I have examined the xml export, and the only thing I can think of that might be a problem is that some of the object IDs for some contained items are base64-encoded and may contain Russian characters. But that does not seem to be the problem, since a similar, smaller import with only ascii characters fails with the same traceback and BadPickleGet:10. I realize that this might be an uninteresting edge-case. My backup plan is to write a script to pull the data out of the XML export and recreate the objects. Does anyone have any pointers on that? I am having trouble figuring out how that file is organized. For completeness, I am using zope-2.8.0, but this happens on 2.7.6 as well. -Jim Washington ___ 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] "Picture of the day" product
Hi, Tim context.ZopeTime() or container.ZopeTime() ZopeTime is not in the PythonScript's namespace. It is available in most (all?) containers, however. -- Jim Washington Timothy Wilson wrote: > > On Mon, 29 Jan 2001, Tres Seaver wrote: > > > > I'd like to grab all instances with a display_date <= today's > > > date. I can't figure out exactly how to do that in DTML or a > > > Python Script. Once I have that list of instances, I'll simply > > > pull off the latest one as you suggested. > > > I don't know where it would be in the book it would be, but > > I do this something like:: > > > > > > > > The expression would be basically the same in a PythonScript:: > > > > return context.theCatalog( meta_type='Photo' > >, display_date=ZopeTime() > >, display_date_usage='range:max' > >, sort_on='display_date' > >, sort_order='reverse' > >) > > Great! The first DTML example works perfectly. The second, however, throws > up an error. In fact, I have yet to figure out how to use ZopeTime() in a > PythonScript. Do I have to pass anything in? > > I get: > > Error Type: NameError > Error Value: ZopeTime > > when I try it. > > -Tim ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] porting from Python Methods to PythonScriptsin2.3.0;LoginManager too
Hi, Fred I discovered another bug in it. Where it changes stuff with "self[", it changes it to "container.", which is wrong, but a simple edit. new code: import string ids = container.objectIds('Python Method') oldscriptsuffix='.old' #replace all self. with the following: #change to context if needed newself = 'container' #for future programmatic use just to be certain no extra dots if string.find(newself,'.') >= 0: newself = string.replace(newself,'.','') for method_id in ids: method_id = string.strip(method_id) #get the Method and its title method = container[method_id] title = method.title #FTPget does not require external method! thebody = method.manage_FTPget() #get the params eop = string.find(thebody,'') params = thebody[8:eop] params = string.replace(params,' ','') params = string.replace(params,'self,','') params = string.rstrip(string.replace(params,'self','')) body = thebody[eop+10:] #get the body newbodylist = [] splitbody = string.split(body,'\n') #do imports as needed #bug: random will be imported if you use whrandom for animport in ['string','whrandom','random','math']: if string.find(body,animport+'.') >= 0: newbodylist.append('import ' + animport) for k in splitbody: #this would be a good place for re newstring = string.replace(k,'self.',newself + '.') #bug: might miss 'self [' wish re were available newstring = string.replace(newstring,'self[', newself + '[') newbodylist.append(string.rstrip(newstring)) body = string.join(newbodylist,'\n') # uncomment to see the raw data # print 'params = "%s"' % params # print 'body is:\n"%s"' % body #rename the old and create the new. don't do more than once. if method_id [-len(oldscriptsuffix):] <> oldscriptsuffix: container.manage_renameObject(method_id,method_id+oldscriptsuffix) container.manage_addProduct['PythonScripts'].manage_addPythonScript(method_id) newscript = container[method_id] newscript.ZPythonScript_setTitle(title) newscript.ZPythonScript_edit(params, body) print 'converted: \t%s' % method_id if len(printed) < 9: print "No methods to convert" return printed Thanks for trying it. Let me know any other bugs, and I may eventually publish a howto. -- Jim > > Jim, > > Thanks for the script. I plan to give it a try. > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] porting from Python Methods to PythonScripts in2.3.0;LoginManager too
The text of an external method for converting Python Methods to Python Scripts was posted to the list a while back. I forget who because I just copied and pasted at the time. Anyway, credit to whoever, and apologies for not having the name. I took that and made something that works for me as a Python Script. (Though my Methods have been rather simple...) Standard caveats, YMMV, etc, but it does a quick pass on the Methods in the folder where it is and makes Scripts from them when you hit the 'test' tab, saving the old ones as methodname.old. It's not perfect (e.g., it will import random if you use whrandom); it's just a bit easier than manually editing (copy, paste, edit) for the same functionality. It would be pretty easy to recurse all folders and change them all, but I am not that bold yet. It seems debugged enough to post. I am sure someone will let me know if otherwise. -- Jim Washington begin code import string ids = container.objectIds('Python Method') #what suffix do we want on the old Methods? oldscriptsuffix='.old' #replace all self. with the following: #change to context if needed newself = 'container' #for future programmatic use just to be certain no extra dots if string.find(newself,'.') >= 0: newself = string.replace(newself,'.','') for method_id in ids: method_id = string.strip(method_id) #get the Method and its title method = container[method_id] title = method.title #FTPget does not require external method! thebody = method.manage_FTPget() #get the params eop = string.find(thebody,'') params = thebody[8:eop] params = string.replace(params,' ','') params = string.replace(params,'self,','') params = string.rstrip(string.replace(params,'self','')) body = thebody[eop+10:] #get the body newbodylist = [] splitbody = string.split(body,'\n') #do imports as needed #bug: random will be imported if you use whrandom for animport in ['string','whrandom','random','math']: if string.find(body,animport+'.') >= 0: newbodylist.append('import ' + animport) for k in splitbody: #this would be a good place for re; put container where self was newstring = string.replace(k,'self.',newself + '.') #bug: might miss 'self [' wish re were available newstring = string.replace(newstring,'self[', newself + '.') newbodylist.append(string.rstrip(newstring)) body = string.join(newbodylist,'\n') # uncomment to see the raw data # print 'params = "%s"' % params # print 'body is:\n"%s"' % body #rename the old and create the new. don't do more than once. if method_id [-len(oldscriptsuffix):] <> oldscriptsuffix: container.manage_renameObject(method_id,method_id+oldscriptsuffix) container.manage_addProduct['PythonScripts'].manage_addPythonScript(method_id) newscript = container[method_id] newscript.ZPythonScript_setTitle(title) newscript.ZPythonScript_edit(params, body) print 'converted: \t%s' % method_id if len(printed) < 9: print "No methods to convert" return printed end code Evan Simpson wrote: > > From: "Fred Yankowski" <[EMAIL PROTECTED]> > > + Don't copy over SiteAccess and PythonMethods. > > + Delete the PythonMethods product from the Control_Panel/Products > > management folder. > > > > Will I have to manually convert each existing Python Method to > > a PythonScript, or are they essentially the same type? > > They are radically different types, and can therefore live in the same Zope, > side-by-side, without conflicting. There is no automatic conversion > process. Simply keep PythonMethods installed, and replace individual > Methods with Scripts as you feel the need. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] PythonScripts documentation
The new online help in 2.3 may have some answers to your questions. Do you have that? It's in Zope Help->API Reference->PythonScript -- Jim Washington Gerald Gutierrez wrote: > > Where is the latest documentation for PythonScripts located? The closest I > found is > > http://www.zope.org/Members/4am/PythonMethod > > but it is dated and contains minimal information. > > I'm specifically interested in what I can do with them and what I cannot do > with them. > > Thanks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClass Adding Magic Needed
Hi, Geoff Your situation looks like application logic confusion enhanced by the weirdness of DTML. Use a Python Script/Method to do the background heavy lifting. If you are using , and REQUEST.set() to access your items, it can be done much more simply and understandably in a Python Script/Method. -- Jim Washington "Geoffrey L. Wright" wrote: > > So: > > I have a odd little problem that I can't seem to solve. I have two > zclasses. We'll call them zclass1 and zclass2. zclass2 lives inside > of zclass1. zclass1 has the following two properties: id and > displayOrder. zclass2 has the four properties: id, displayOrder, > alignment and content. In both cases the id is an automaticly > generated unique number based on ZopeTime. > > My problem is that I need to make a public add method that generates a > new instance of zclass1 with a new instance of zclass2 inside of it. > I also need to be able to control set the displayOrder of zclass1, and > the alignment and content of zclass2 from the same form. The > displayOrder of zclass2 will be static for the time being, but I'll > ultimately need to control that as well. > > I hacked the default add method of zclass1 so that it generates a new > instance of zclass2 each time, and using the Job Board HOWTO I managed > to make a public add method. So far so good. But now I can't for the > life of me figure out how to pass some form variables to one object > and some to the other, especially while they have some identically named > properties. > > Any hints on this one? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses meet PythonScripts, sample request
Timothy Wilson wrote: > > On Mon, 15 Jan 2001, Jim Washington wrote: > > > Where is the editFormAction Python Script? It should be in your ZClass's > > /methods. If you are instead acquiring it from a Folder somewhere, you > > will need to use 'context' instead of 'container' inside the Python > > Script. > > I'm not getting any errors now that I've changed the editFormAction to refer > to 'context'. My guy feeling is that these methods should be methods of the > ZClass so I'll probably change that, but for now no errors. > > Unfortunately, however, the instance isn't getting updated either. After > hitting submit I get the red "Your changes have been saved" and the edit > form is visible, but the same old values are there. When I view the instance > after updating I also see the same of values. Apparently either REQUEST > doesn't contain the data it's supposed to or the instance isn't being > properly modified with REQUEST's contents. Any thoughts? I would put the Python Script in the ZClass's /methods and see what happens. -- Jim ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim What is the name of the propertysheet in your ZClass that these values are on? Is it 'job_info'? Where is the editFormAction Python Script? It should be in your ZClass's /methods. If you are instead acquiring it from a Folder somewhere, you will need to use 'context' instead of 'container' inside the Python Script. -- Jim Washington Timothy Wilson wrote: > > On Mon, 15 Jan 2001, Jim Washington wrote: > > > I have it. > > The Python Script I sent you: > > > > container.propertysheets['job_info'].manage_changeProperties(REQUEST) > > > > needs to be rewritten: > > > > container.propertysheets.job_info.manage_changeProperties(REQUEST) > > Hey Jim, > > I'm getting closer. Now I get the following error and traceback: > > Error Type: AttributeError > Error Value: job_info > > Traceback (innermost last): > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 222, in > publish_module > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 187, in > publish > File /var/lib/zope/2.3.0a2/lib/python/Zope/__init__.py, line 221, in > zpublisher_exception_hook > (Object: Traversable) > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 171, in > publish > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/mapply.py, line 160, in > mapply > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 112, in > call_object > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/OFS/DTMLMethod.py, line 189, in > __call__ > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_String.py, line > 538, in __call__ > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_Util.py, line > 336, in eval > (Object: editFormAction(REQUEST)) > (Info: REQUEST) > File <string>, line 0, in ? > File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line > 325, in __call__ > (Object: editFormAction) > File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line > 354, in _bindAndExec > (Object: editFormAction) > File > /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/PythonScript.py, > line 321, in _exec > (Object: editFormAction) > (Info: ({'script': <PythonScript instance at 873fbd8>, > 'context': <JobPosting instance at 86b7dc0>, 'container': <Folder > instance at 87225f0>, 'traverse_subpath': []}, > (<h3>form</h3><table><tr > valign="top" >align="left"><th>posted</th><td>'01/15/2001'</td></tr><tr > valign="top" >align="left"><th>duties</th><td>['asdfasdf\015\012']</td></tr><tr > valign="top" >align="left"><th>position</th><td>'asdfadsfasd'</td></tr><tr > > -- again snipping the rest of REQUEST -- > > File Python Script, line 2, in editFormAction > File /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/Guarded.py, > line 272, in __getattr__ > File /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/Guarded.py, > line 143, in __careful_getattr__ > (Object: Traversable) > AttributeError: (see above) > > Any ideas? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim I have it. The Python Script I sent you: container.propertysheets['job_info'].manage_changeProperties(REQUEST) needs to be rewritten: container.propertysheets.job_info.manage_changeProperties(REQUEST) Perhaps someone could explain why the first does not work. One point about your form: You have id as a form variable. You will be disappointed by its behavior. Regards, -- Jim Washington Timothy Wilson wrote: > > Jim (or anyone else who's feeling charitable this morning), > > Thanks for all your help. I really appreciate it. I wonder if you'd have > time to look one more time at the two methods I've got that aren't > working. I've included the actual code for my job posting product. Perhaps > someone will find it instructive. I have a feeling that the remaining > problem is not directly related to the processing of the form by the > PythonScript. I also included the traceback at the end of this message. > > Here are the two methods. I have a table that displays the currently > available jobs and displays two little icons which call the edit or delete > methods on the corresponding instance of the 'Job Posting' class. The edit > icon links to the 'editJobForm' method which in turn calls the > 'editFormAction' method that actually processing the change. > > -- > editJobForm > - > > > > Edit a Job Board Entry > This form allows you to make changes to current postings on the online > job board. You don't needed to fill in every > field on the form. Click on the "Submit Edits" button at the bottom of the > screen to save your changes to the database. > > > > Your changes have been saved > > > > > > Notes > notes> > > Job ID > > > Organization > > > Position > > > Description > name="description:text" rows="10" cols="60" wrap="virtual"> description> > > Pay Offered > > > Line of Authority > > > Function > name="function:text" rows="4" cols="60" wrap="virtual"> function> > > Qualifications > name="qualifications:text" rows="8" cols="60" wrap="virtual"> qualifications> > > > > To create a bullet list of "duties," type each one in the box below and > press the "ENTER" key > between each item in the list. > > > Duties > > duties> > > > > name="duties:list" rows="10" cols="60" wrap="virtual"> > > > Offer Expires > "> > > > Enter the date that the job was officially posted. > > Posted Date > "> > > > > > > > > > > > > > > > > - > editFormAction (with REQUEST as a parameter) > - > > container.propertysheets['job_info'].manage_changeProperties(REQUEST) > > The error I get is: > > Error Type: TypeError > Error Value: sequence index must be integer > > Traceback: > > Traceback (innermost last): > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 222, in > publish_module > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 187, in > publish > File /var/lib/zope/2.3.0a2/lib/python/Zope/__init__.py, line 221, in > zpublisher_exception_hook > (Object: Traversable) > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 171, in > publish > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/mapply.py, line 160, in > mapply > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 112, in > call_object > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/OFS/DTMLMethod.py, line 189, in > __call__ > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_String.py, line > 538, in __call__ > (Object: editJobForm) > File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_Util.py, line > 336, in eval > (Object: editFormAction(REQUEST)) > (Info: REQUEST) > File <string>, line 0, in ? > File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line > 325, in __call__ > (Object: editFormAction) > File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line > 354, in _bindAndExec > (Object: editFormAction) > File > /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/PythonScript.py, > line 321, in
Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim You do not need to mess with the Python Script bindings. It looks like you are trying to get URL: www.isd197.k12.mn.us/hr/jobs/postings/1234/editJobAction(REQUEST) Which of course does not exist. I would change your assuming the DTML Method that has the form is called editJobAction. Don't worry about passing REQUEST there; Zope takes care of that. -- Jim Washington Timothy Wilson wrote: > > This seems to almost work. :-) > > On Sun, 14 Jan 2001, Jim Washington wrote: > > > ! > > > > ! > > ! > > ! Your changes have been saved > > ! > > > > ! > > > > > > Title > > > > > > > > Artist > > > > > > > > > > ! > > > > > > > > ! > > That's quite clever. I wouldn't have thought of doing it that way. > > After translating the CD example to my own ZClass, I get the following error > after hitting "Submit Edits" on the edit form: > > Zope Error > Zope has encountered an error while publishing this resource. > > Resource not found > Sorry, the requested Zope resource does not exist.Check the URL and try > again. > > > and the traceback: > > Traceback (innermost last): > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 222, in > publish_module > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 187, in > publish > File /var/lib/zope/2.3.0a2/lib/python/Zope/__init__.py, line 221, in > zpublisher_exception_hook > (Object: Traversable) > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 162, in > publish > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/BaseRequest.py, line 369, > in traverse > File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/HTTPResponse.py, line > 528, in notFoundError > NotFound: (see above) > > It looks like REQUEST isn't getting passed correctly. I've got REQUEST > listed as a parameter for my PythonScript. I don't need to mess with > bindings do I? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim > > > > You will want to pass REQUEST to it so you can use it like the Zope > > builtins: > > > > containerName.CDInfoName.manage_changeCDProperties(REQUEST) > > > > So, put REQUEST in the parameters list. > > I'm afraid I'm a bit confused here. Is 'CDInfoName' the id of an instance of > this CD class? If so, what would 'containerName' be? Yes. CDInfoName here would be an instance of your CD Class. containerName is the name of the container, whether it be a folder or a folderish ZClass made for handling a collection of CD Class objects. It doesn't have to be there in the statement unless something else is asking the folderish object to ask the CD Class object to change the properties, which at the moment seems kind of silly. I must have gotten off on containers with your second question about deletion. Apologies for the confusion. > In the particular example I'm thinking about (not a CD collection), I've > created a form that displays the current properties of the class (a job > opening for the H.R. deparment in my case), allows the user to modify any of > the properties in the form, and submit those changes. I suppose for the CD > example it would something like: (ignoring everything but the form) > > > > > Title > > > > Artist > > > > > > > > > > I don't think I'm calling the PythonScript correctly. In fact, I suspect I'm > quite a bit off. I think it would work, at least as far as updating the properties, but it would not return anything. See below my attempt at an alternative. > > Inside the script, you would use Zope's manage_changeProperties method: > > > > context.propertysheets['cd_info'].manage_changeProperties(REQUEST) > > -or- > > context.propertysheets.cd_info.manage_changeProperties(REQUEST) > > Following Evan's advice, would this then be: > > container.propertysheets['cd_info'].manage_changeProperties(REQUEST) > > So that's a one-liner? Hmmm. Cool if true. :-) Always has been, even in DTML. > Let's say that I wanted to redirect the user back to the Web page where they > had begun this process. How would that be accomplished? There are many ways. I like to make it all happen at the beginning of the DTML Method. Hacking up the form you provided above (lines with ! have been added or changed): ! ! ! ! Your changes have been saved ! ! Title Artist ! ! Hoping I have not confused further, -- Jim Washington > > Timothy Wilson wrote: > > > > > > Hi everyone, > > > > > > I'm looking forward to using some PythonScripts as methods of some ZClasses > > > because it seems like a much cleaner way to do things. I wonder if one of > > > the PythonScript gurus out there would be willing to show an example of two > > > presumably common PythonScript/ZClass tasks: processing changes to a > > > property sheet using form input and deleting a ZClass instance. > > > > > > Let's say we've got a ZClass for keeping track of a CD collection. (I recall > > > seeing that example in a ZClass How-To.) Let's say the ZClass has a property > > > sheet called 'cd_info' with the following properties: > > > > > > title (string) > > > artist (string) > > > date_purchased (date) > > > > > > (for extra credit, add a 'songs' property of type 'lines' :-) > > > > > > Is that enough info? Anybody want to take a crack at this? (This would > > > surely be good info to put at zope.org somewhere.) > > > > > > -Tim ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim I am not working through that example, but the below is a start on what you seem to need. Let me know what you think. good luck! -- Jim Washington *** You probably want the work to be done in the context of an instance of the class, so assure you have "context" bound to the Python Script on the "bindings" tab. It's bound by default. You might want to name the Script in a Zopish way to distinguish it from other scripts that may do other things. I would probably call it manage_changeCDProperties. You will want to pass REQUEST to it so you can use it like the Zope builtins: containerName.CDInfoName.manage_changeCDProperties(REQUEST) So, put REQUEST in the parameters list. (BTW, REQUEST is available as context.REQUEST if you choose not to pass REQUEST.) Inside the script, you would use Zope's manage_changeProperties method: context.propertysheets['cd_info'].manage_changeProperties(REQUEST) -or- context.propertysheets.cd_info.manage_changeProperties(REQUEST) You're done, unless you want to get fancy and process the items separately. If you want to get fancy, REQUEST.form['title'], REQUEST.form['artist'], and REQUEST.form['date_purchased'] are available to you. For example, if you want to assure title case for title and artist (try this in DTML first, just to get the scope of how much easier it is in a Python Script): import string dontCapitalize = ['a','in','of', 'for'] localPropertiesDict = {} for aproperty in ['title','artist']: theProperty = string.strip(REQUEST.form[aproperty]) splitWords = string.split(theProperty) newlist = [] for aWord in splitWords: if aWord in dontCapitalize and aWord != splitWords[0]: newlist.append(string.lower(aWord)) else: newlist.append(string.capitalize(aWord)) newValue = string.join(newlist,' ') localPropertiesDict[aproperty] = newValue context.propertysheets['cd_info'].manage_changeProperties(localPropertiesDict) To delete something from the ZODB, pass a list of ids to manage_delObjects in your container. To delete them all: thelist = context.containerName.objectIds('CD_Info') context.containerName.manage_delObjects(thelist) Let's say you lent out all your Britney Spears CDs and don't expect to get them back. How do you update your collection? Make a form that allows you to select 'Britney Spears' into a variable called 'deleteThisArtist' Make a Python Script that is called by the action for the form. This goes into your class for CD collection, whatever you have named it. import string #we make this case-insensitive by converting all to uppercase deleteMe = string.upper(context.REQUEST.form['deleteThisArtist']) listToDel = [] for CD in context.objectValues('CD_Info'): if string.upper(CD.artist) == deleteMe: listToDel.append(CD.id) #in Zope-2.3.0+, you should use .getId() instead of .id context.manage_delObjects(listToDel) Timothy Wilson wrote: > > Hi everyone, > > I'm looking forward to using some PythonScripts as methods of some ZClasses > because it seems like a much cleaner way to do things. I wonder if one of > the PythonScript gurus out there would be willing to show an example of two > presumably common PythonScript/ZClass tasks: processing changes to a > property sheet using form input and deleting a ZClass instance. > > Let's say we've got a ZClass for keeping track of a CD collection. (I recall > seeing that example in a ZClass How-To.) Let's say the ZClass has a property > sheet called 'cd_info' with the following properties: > > title (string) > artist (string) > date_purchased (date) > > (for extra credit, add a 'songs' property of type 'lines' :-) > > Is that enough info? Anybody want to take a crack at this? (This would > surely be good info to put at zope.org somewhere.) > > -Tim ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] get property of type 'list'
Hi, Andrei I think I have it figured out. I just submitted something similar to the Collector about an analogous problem I have been having with 'lines' properties. When you create your tokens property, you should make its value a string, like: '1 2 3' not a list: [1, 2, 3] If your data is in a list and you want to use that list as tokens, you need to join the list into a string first: mylist = ['1', '2', '3'] fortokens = string.join(mylist,' ') That's the python, but you can do it in DTML using _.string.join(. Be careful to convert your integers to strings first. What's happening to you is that the string representation of the list, "[1, 2, 3]" is getting stored verbatim as your tokens property, and ZPublisher/Converters.py is then splitting it on the spaces when you ask for it. Which is how you get that weird '[1,' '2,' '3]'. -- Jim Washington Andrei Belitski wrote: > > Hi! > I add a list property to a DTML document of type 'tokens' (e.g. '[1, 2, > 3]') wenn i try to retrieve it with _.getitem i get '[1,' '2,' '3]' > instead of '1' '2' '3' > How can I get Zope to interpret my property like a list not a string or > whatever else? > Thank you in advance! > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) -- Jim Washington Center for Assessment, Evaluation and Educational Programming Department of Teaching and Learning, Virginia Tech ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to split a string in a python method?
Yes. Just use it. string is already in the Python Methods namespace. EXAMPLE: Python Method Parameter list: self Python function body: testsentence = 'I want this sentence to be converted into a list of its component words.' thelist = string.split(testsentence) for aword in thelist: print aword return printed -- Jim Washington Juan Carlos Coruña wrote: > > Is there any way to split a string in a PythonMethod without passing the > object _.string as an argument? > > I have tried to "import string" but Zope generates an ImportError: > > ImportError: __import__ not found > > I'm using PythonMethod 0.1.7 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] html_quote in python methods?
Thanks, Andy, Dieter, Chris, Evan for the discussion What I ended up doing was making a DTML Method called htmlquote_newlineToBr that looks like: then calling it from a Python Method like so: hqnl = self.htmlquote_newlineToBr myitem=self.fixedLoc['varLoc1']['varLoc2'] print '' print '%s' % hqnl(theitem=myitem.property1) print '' It turned out to be a bit better code than I thought I wanted :) -- Jim Washington > - Original Message - > From: "Jim Washington" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, January 02, 2001 6:32 AM > Subject: [Zope] html_quote in python methods? > > > I am using Python Methods a lot now. > > > > Good: > > no more to get to the objects I need. Yay! > > no more worrying about closing blocks. Yay! > > > > OK, when I make a syntax error, there is no help in the traceback. My > > Python is getting better and better as a result. > > > > To give something back, I have a hint that took me a while to figure > > out: > > > > print '%s' % (self.thevariable) > > will not work. The first % needs to be escaped like so: > > > > print '%s' % (self.thevariable) > > > > Now, can I use html_quote in a Python Method? I am letting people enter > > data for redisplay, and I know some Bozo (TM) will somehow put in > > "" > > and break the page. > > > > Can I keep this from happening? html_quote does not seem to be in the > > Python Method namespace. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] html_quote in python methods?
I am using Python Methods a lot now. Good: no more to get to the objects I need. Yay! no more worrying about closing blocks. Yay! OK, when I make a syntax error, there is no help in the traceback. My Python is getting better and better as a result. To give something back, I have a hint that took me a while to figure out: print '%s' % (self.thevariable) will not work. The first % needs to be escaped like so: print '%s' % (self.thevariable) Now, can I use html_quote in a Python Method? I am letting people enter data for redisplay, and I know some Bozo (TM) will somehow put in "" and break the page. Can I keep this from happening? html_quote does not seem to be in the Python Method namespace. Regards, -- Jim Washington ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Anonymous user
There might be a couple more variables to consider. If I were trying to get back into my site I would try: 1. Clearing the browser cache 2. Using the "superuser" name and password 3. Going directly to the management pages: /manage_workspace (manage_access does security, and manage_UndoForm has the undo stuff if you just want to undo the last permissions change) 4. Using a different browser (the "username:password@" convention is apparently not handled uniformly by the various browsers). Cookies should not make too much of a difference, but management screens do use them for the tree tags and height/width of edit boxes. You are still using basic authentication, I presume? Keep trying. All is not lost. One of the above or some combination ought to work. -- Jim Washington Priya Ramkumar wrote: > > Hi Jim > > I tried typing the following url but it still logs in as "anonymous user". > The cookies are also disabled in my browser. > > priya > > >Put the username and password in the url like this: > > > >http://managername:[EMAIL PROTECTED]/manage > > > >-- Jim Washington > > > >> Priya Ramkumar wrote: > >> > >> Hi > >> > >> Could anyone please help me with this problem? > >> > >> I changed the default permission for the Anonymous user by adding the > >> permission "View Management screens". So the next time I opened the > >> site, and wanted to go into the management screen, it took me directly > >> to the management screen. But as an Anonymous user, I do not have any > >> security permissions and hence unable to change back the permissions. > >> The problem is that I want to now login as "manager" and i am unable > >> to do so as it does not wait for the username & password to go to the > >> management screen. What is the way I could login as manager again & > >> change the permission settings? > > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Anonymous user
Put the username and password in the url like this: http://managername:[EMAIL PROTECTED]/manage -- Jim Washington > Priya Ramkumar wrote: > > Hi > > Could anyone please help me with this problem? > > I changed the default permission for the Anonymous user by adding the > permission "View Management screens". So the next time I opened the > site, and wanted to go into the management screen, it took me directly > to the management screen. But as an Anonymous user, I do not have any > security permissions and hence unable to change back the permissions. > The problem is that I want to now login as "manager" and i am unable > to do so as it does not wait for the username & password to go to the > management screen. What is the way I could login as manager again & > change the permission settings? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] mySQL DA on Win32
Hi, Lee I got zope and mysql working together last night on win2k. I used the instructions in http://www.zope.org/Members/philh/mysql (Thanks, Phil Harris!) I did have to use the custom dll and pyd mentioned there. http://www.google.com/search?q=mysql+zope+win32 might have more clues if this does not meet your needs. To answer your next question, the connection string is like 'db@host username password' hth, -- Jim Washington Lee Reilly CS1997 wrote: > > Hi, > > Zope is currently being installed on the Unix machines at my uni but it > won't be available for a while. However, I have set up a mySQL database > in the Dept. and installed Zope on a Dept. machine (Windows 95). I can > only access the database from uni so I must have a database adpater > setup on this machine. > > I have seen the mySQL DA on Zope.org but I understand that it "does not > support win32 platforms at this time". I need database access ASAP so > can anyone offer any advice? > > Thanks very much, > > Lee ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] string splitting in dtml
Just a thought: Have you tried using "_.str(thedate)" to convert it into a string? I am not using Access, but since Zope can handle the Access date stuff properly, it may be using something like _.str() internally. It's what I would try first. -- Jim Washington "Spicklemire, Jerry" wrote: > > Mike said: > > > I tried what you recommended and got the following error: > > > > Error Type: AttributeError > > Error Value: __getslice__ > > > > The problem I think is that the variable is drawn from the database as > type > > date (Microsoft Access 2k) and somehow is cast into a date type. Is there > a > > way to re-cast this variable as a string type? > > You're right, it's not really a string, even though Zope is smart enough > to render it into one when inserting it directly into HTML. > > > I also tried the > > > > > > > > solution but got the error: > > > > Error Type: TypeError > > Error Value: argument 1: expected read-only character buffer, instance > found > > Now if only Zope were smart enough to tel us what it "really" is, > so we could transform it! > > It looks like MS Access delivers dates as some proprietary object type. > > However, in your query, you may be able to wrap the date field like so: > > to_char(dateFieldName) > > to convince MS Access to return a formatted string instead. > Once you can see what the string looks like, the slicing bit > should work. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses & inheriting property(sheets) : yes/no?
Hi, Your name is zope? There is no need for an acquiring or containment relationship. What has worked for me: -Product main folder |-virtualclass |-descendentclass1 |-descendentclass2 where descendentclass1 and descendentclass2 are both descended from virtualclass. i.e, virtualclass shows up in both descendentclasses' "basic" tab as a Base Class. This was established in the "base Classes" area when the ZClasses were created. Ooh. I just checked, and this is probably what you are looking for: The property sheet will not show up in the descendents' view method list unless the base class also has a view established of the property sheet. hth, -- Jim Washington [EMAIL PROTECTED] wrote: > > I've been struggling with this problem myself. In particular I can't > get the parent propertysheet management method to appear on the Views > method list. Is it necessary that the subclass also be contained in > the parent? In my design, there is no containment or acquiring > relationship between the parent class and the subclass. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] come see new.zope.org
For the time being, most of us probably want to put 63.102.49.33 in the /etc/hosts file (I forget where it is in Win32) so all the links work. It seems pretty quick from here. Good show, Ethan! -- Jim Washington Chris Gray wrote: > > Then try 63.102.49.33. The new name just hasn't propagated to your > dnsserver yet. > > Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Newbie Question
Dany: These should work: -or- -or- --Jim Washington Dany Rioux wrote: > > I'm probably just being dumb... :) > > -- > > > > > > > > > > > -- > > This doesn't work. Nothing gets printed. > > In the News folder is a DTML method called news999. Should it be a > DTML document instead for this to work? > > I tried the three methods you gave me. objectValues, "objectValues()" > and "objectValues('[File]')" and even "objectValues('[news999]')" but > empty everytime. > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Passing paramaters for form processing
Hi, Steve Inside the form, you probably want: -- Jim Washington steve smith wrote: > > How do I set some parameters for use in a form processing method? I have a > HTML "FORM" tag referencing a DTML method name, and I want that method to > have visibilty of some variables from the calling methods space. I've tried > passing them with the url (eg, "ACTION=/someurl?fred=") and > by using REQUEST.set syntax in the calling method. Neither seems to result > in the variable being visible to the form processing method. Any ideas? > > Steve ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] DTML and SQL question...
Hi, Marc The SQL engine usually returns something that looks like a list of lists. So, you might try using (untested, but I have done similar things) "genericSQL(SQLStatement='Select count(*) from my_table where my_field = \'0\'')[0][0] == 0" The [0][0] identifies the first cell in the first row of what is returned, which should be the value you are looking for. I have not used the genericSQL statement, but this idea has worked for me in the past. hth, -- Jim Washington zope wrote: > > Hi. > > I want to test if there is some data in a table. > If so, I want to perform some action, otherwise I wan't to print out a message. > () > > My SQL statement is something like: > > Select count(*) from my_table where my_field = something > > What DTML code do I need to perform that if-statement? > > Something like the following does not work :-( > > >YES! There's some data! > >no records found! > > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZClasses & inheriting property(sheets) : yes/no?
Hi, Aaron Yes. If your parent ZClass is constructed properly, you should be able to add the parent class's management tabs by setting a "view". On the "Views" tab, look in the Method list for propertysheets/[ParentClassPropertySheetName]/manage. The properties on that sheet are accessible just like any of the child class's properties. -- Jim Washington Aaron Straup Cope wrote: > > Hi, > > If I create a ZClass that inherits another ZClass, do I also inherit the > latter's properties/propertysheet? From what I've read so far, I thought > the answer was yes but I can't seem to figure out how to *get* at them. > > I created a ZClass called "Foo" that inherits a ZClass named "Meta". Meta > had two properties : author and title but neither appear to be set when > I create a new Foo object. > > I banged out something in plain-old Python (see below) since I was pretty > sure this was the kind of thing Python was so good for (I am normally a > Perl weeniesh :-) and everything worked fine. > > I've been looking around the docs and the how-to's but nothing seems to > discuss the idea of inheriting properties (?) across ZClasses. Is it > possible? > > Thanks, > > class Meta: >def __init__(self,title,author,timestamp,keywords,body,public,display): >self.title = title >self.author= author >self.timestamp = timestamp >self.keywords = keywords >self.body = body >self.display = display >self.public= public > > > > from Meta import Meta > class Library(Meta): > def > __init__(self,title,author,timestamp,keywords,body,public,display,foo,bar=""): > > Meta.__init__(self,title,author,timestamp,keywords,body,public,display) > self.foo = foo > self.bar = bar > > > > from Meta import Meta > class LibraryClass(Meta): > def __init__(self,title,author,timestamp,keywords,body,public,display): > Meta.__init__(self,title,author,timestamp,keywords,body,public,display) > > *** > > # from yadda yadda import ... > lib = Library("budwork","bud","now",["foo","bar"],"bobdy",1,0,"foopybird") > libclass = LibraryClass("classwork","bud","now",["foo","bar"],"bobdy",1,0) > > print "Class Title is " + lib.title > print "LibClass Title is " + libclass.title > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) -- Jim Washington Center for Assessment, Evaluation and Educational Programming Department of Teaching and Learning, Virginia Tech ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] QSurvey design
Hi, Stephan QPages draw themselves. The code is QPageClass:index_html, so replacing the header information in that method with standard_html_header should work. You may want to include the css stuff in your header for question formatting (needs to be in , and that is why I broke tradition and hard-wired the header). Standard_html_footer is still there, so that should already work. -- Jim Washington Stephan Goeldi wrote: > > How can I change the HTML design of QSurvey 0.25? > I want it to use my standard_html_header and footer. > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to type check OR better list selector ways
Hi, Robert BTW, this is a FAQ, but: use the :list extension in your html. e.g., Works for checkboxes, too! -- Jim Washington Robert Joseph Roos wrote: > > > > causes a name error, while other python builtins > like _.string(some_int) work fine. What gives? > Is there some other "zopist" way to type-check? > > More generally, is there a better way to deal with the annoying > fact that multiple selectors return a list UNLESS there are > <=1 items selected, in which case they return a single item or None? > > (rather than a list with only one member, in the case of 1 object > selected, or an empty list, in the case of none, > which would SEEM to be the consistant way to do things, > since wouldn't choke.) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to include Flash/SWF objects in Zope website?
N.B. You probably should add your Flash/SWF objects as "File" objects. DTML Method/Document objects can do amusing things with binary data, which is why there are "File" objects. -- Jim Washington J. Atwood wrote: > You could just upload them into Zope and point to them. > > http://www.gotschool.com (see flash demos). > > It uploads as a "application/octet-stream" > > I am sure you are talking about much more interaction. > > J > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: [Zope-dev] build Zope on linux
Hi, Kent Sin dpkg -S tells you what package contains a file: jwashin@vpave5:/$ dpkg -S mymath.h python-dev: /usr/include/python1.5/mymath.h So, it would appear the python-dev package is the one you need. -- Jim Washington Sin Hang Kin wrote: > > When building current zope cvs, cPickle.c want the mymath.h. Where can I get > mymath? What devel package I should install for a debian system? > > Rgs, > > Kent Sin > - > kentsin.weblogs.com > kentsin.imeme.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Base ZClass propertysheet management
Hi, Seb Go to the "Views" tab of the ProductItem ZClass. You should be able to add another tab referring to propertysheets/Picture/manage. This has worked for me in a similar situation. -- Jim Washington Seb Bacon wrote: > > Thanks, > > I'll rephrase it using my real life problem: > > I have a Picture class, which comprises image, title, description, etc. > I also have a ProductItem class, which subclasses Picture to include a > price, etc. > > So finally I have got a ProductItem class, which has a title, image, price, > ... > > I can access properties inherited from the Picture no problem. The problem > is that the default management screen for editing the properties of > ProductItem, propertysheets/Details/manage, only provides a means of editing > the unique properties of ProductItem. Is there a means of managing all the > properties of a ZClass, including those of its parent class? Or do I have > to code my own management screen to do this? And if so, what is the correct > way of refering to these properties in DTML? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] help! dtml-if question
Hi, Anthony how about: 0"> Your _.has_key() (I think you meant _.hasattr()) statement was looking for something named "Blurb", not a thing of type"Blurb", so of course it failed. The objectValues(['atype']) statement returns a list of the things of the type, so checking for a non-zero length of the list will do what you need. -- Jim Washington Dr. Anthony Monta wrote: > Hi, > > I've tried to find a solution myself but now am stuck. I created a > little "Blurb" product for a university department website so that > faculty members can announce recent publications on the department's > homepage. They create these ZClass instances in their own folders, > and a DTML method in the top-level folder grabs and displays them at > random. (I want to avoid using ZCatalog for the time being.) What > the method does is randomly choose a faculty folder, and then randomly > choose a Blurb instance within that folder. Here's the hack I came up > with: > > > > > > > > > (end tags omitted) > > The problem is that this method will produce an Index Error when it > comes across a folder that doesn't contain an instance of "Blurb" > class. So I need to make the selection of a folder conditional on > Zope's finding a Blurb in that folder. Here's what I tried after > reading up: > > > > > > > > > > > Some default Blurb would appear. > > This method fails. Can someone help? > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] List
Tom Deprez wrote: > > Hi, > > I'm storing a selection of a user to a database as string. This selection > is a multiple selection from a select box and is outputted as a list. > Now I want to iterate over this list (after retrieving it from the > database), but how can I do this? How can I tell Zope that the string is > actually a list? How can I typecast in Zope? Use a python or external method to make a list from your string. I am supposing you are storing a string representation of the list that looks like: "['fred', 'bob', 'mary']" Get rid of any punctuation you do not want with (e.g.) theString = string.replace(theString, '[', ' ') (Yes, there are more efficient ways to do this!) Then, once you have a space-delimited list of items, you may use theList = string.split(theString) which will make a list of the words in the string. Return theList. -- Jim Washington ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to generate an Object ID automatically
Hi, Francisco Here's a link to a howto on automatically generating ids. http://www.zope.org/Members/Bill/Documentation/AutoGenID You may want to look at the howto's and zope tips at http://www.zope.org/Documentation. There are a lot of answers to questions you may have there. Now, about getting unexpected authentication boxes on a new ZClass: In my experience, what you need to do is, within your ZClass's management area, go to the Define Permissions tab, and assign "Access Contents Information" to "Access Contents Information", or do something similar with whatever permissions you are having trouble with. The default has few permissions, so you need to manage these things. -- Jim Washington zopist wrote: > > dear zopists, > im a zope newbie and i have one of those little problems ppl like me can spend hours >on ... > i just built my first ZClass and now im trying to automatically assign a generated >ID to an instance of this class in the -add method. > i want to generate the id because there is no unique fieldvalue available and i dont >want to have the users get stuck on this point. > > another problem i encountered is that when i try to add an instance in a folder i >get an authentication box where no valid login is accepted > > i would really much apreciate if someone could help. > > Francisco (chico) Webber ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] QSurvey 0.23 and Zope 2.2.1b
Hi, Alexander I have not worked with 2.2.1b yet and have not seen this. But it sounds like the import is expecting things to be in a different order than the export, which does not help much for a solution. Thus I agree with the error message: (Waaa). If it wasn't for the b I would possibly: 1. Upgrade a test zope to 2.2.1b that has the QSurvey working 2. Export that Product 3. See if the new export works with the new 2.2.1b ZODB in a different install. I would also submit a bug report to the Collector. -- Jim Washington > > Just installed Z2.2.1b, successfully imported some products but when > trying to import QSurvey 0.23 got the message: > > Zope Error > Zope has encountered an error while publishing this resource. > > Error Type: Permission mapping error > Error Value: Attempted to map a permission to a permission, Add > QSurveyResultsItems, that is not valid. This should never happen. (Waaa). > > Any suggestions? > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Changing my session identity
How does one become Anonymous User without stopping/restarting the browser? Is there a special username/password for that? -- Jim Washington Chris McDonough wrote: > > Oops... sorry... > > Unauthorized. > > > Shortcuts on the brain. :-) > > > -Original Message- > > From: Chris McDonough [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 19, 2000 11:43 AM > > To: 'Andreas Rippel'; [EMAIL PROTECTED] > > Subject: RE: [Zope] Changing my session identity > > > > > > In dtml: > > > > > > You are unauthorized. > > > > > > If you enter a new valid username/password combo in, you'll > > be validated > > and your identity will be changed. > > > > If you cancel or enter an invalid username/password combo, > > you'll still > > be logged in as whomever you started with. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with _[xyz]
Hi, Christian Christian Zagrodnick wrote: > > Hi all, > > shouldn't and return the same result? if xyz is a simple variable, yes. > Well - I don't know why but only the 1st is working. > (top.German.ActualPages is a folder; tThisIs... is a dtml-method) > > 1: > > > > > 2: > > > I may be wrong on this, but if the dots indicate subobjects, you may want to do this as Python sequence syntax: "_['top']['German']['ActualPages']" or as "_['top'][aLanguage]['ActualPages']" assuming aLanguage is a variable which may be e.g., 'German' I hope this is a helpful hint. -- Jim Washington > Of course I want to replace the 'top.German.ActualPages' with a variable... > but since it doesn't work with a hardcoded string it'll not work with a > variable. > > Any hint? > > Thanks ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] DTML-IN Question
from the DTML reference page 41, regarding : the default setting for the orphan attribute is 3. So you might try: -- Jim Washington Tom Scheidt wrote: > > Hi my problem is that Im setting my batch size to 3, yet I keep getting > 5 items. As a matter of fact, sometimes I get 4 when asking for 2 and so on. > Here's what Im using: > [code snipped] > > Thanks in advance. > Tom Scheidt | www.falsemirror.com | [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Newbie Question (dropdown menu)
Hi, Joel Just displaying the list in a : If "whatever" already has a value and you want that selected: selected > the tags are apparently optional. hth -- Jim Washington joel grimes wrote: > > I'm trying to fill a combo-box (pardon the vb-centric lingo - I don't know > what the things are called - it's a thing) with items > selected from a table. I haven't a clue how to do this. I've got the ODBC > Connection and SQL Method working, but how do I iterate through the query > results to fill a drop-down? > > Thanks > > Joel Grimes ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Comfirming Hotfix is installed.
Look in /Control_Panel/Products for the Hotfix_xx Product. -- Jim Washington Ian Thomas wrote: > > Is there any way to confirm that the hotfix has been installed? > > I extracted the files and restarted Zope but it would be nice if there was > a way to confirm that it is installed. > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re:[Zope] Importing data
Please, no HTML posts. I crashed Netscape Mail twice trying to reply. Thanks. But to answer, exporting and importing works just fine if you want to copy parts of an existing zope site. It even works recursively, so if you want to export an entire folder of stuff (or Squishdot site) with subfolders, properties, etc., just go to its enclosing folder's "Import/Export" management tab, and follow the directions for exporting. This will create a .zexp file. To import into the new Data.fs file, put the .zexp file you have created into your [where zope is installed]/import folder on your hard drive. Then open the new site's management interface for zope and go to the same Import/Export tab and use the Import part. If you have 2 Data.fs files and only 1 zope, you can switch back and forth between them (stopping and restarting Zope in between so terrible things do not happen) by moving one and then the other into the appropriate var directory to do exporting, or importing as you want. Copies of the original files will come in handy if you confuse easily like me. -- Jim Washington >Well, I meant that I have some products w/ data setup in the new .fs. If I copy the >>old over then I loose what I am currently working on. > > - Original Message - > From: J. Michael Mc Kay > To: [EMAIL PROTECTED] > Sent: Thursday, June 15, 2000 12:26 PM > Subject: [Zope] Importing data > > I have a Data.fs file from a previous instal of Zope. How can import parts of >>that data base to a current data.fs? > > I have a product setup in the old .fs that I want to use in the newlike a >>squishdot for instance. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )