[Zope-dev] Register user/login
Is there any way to have a user login (similar to portal/login manager) but hook it in to the root acl_user list? I tried to decipher it from the above mentioned products but I can't seem to do it. As for using the above products, they are way more complicated for my use. I just need someone to login via a link to a form, and then assign a cookie. which I need to stay alive for a set period I specify. Regards, Gajendra Ratnavel Honours Computer Engineering, University of Waterloo Waterloo, Ontario _ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ___ 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] newbie question -- database list/report with sort bycolumn header
Hi, Chris Gray schrieb: Here's a fragment from a table that allows sorting by clicking the header in a dtml method named 'displayTable': table tr tha href="displayTable?sort_key=ID+desc"ID/a/th tha href="displayTable?sort_key=product"Product/a /tr dtml-in "SQLSelectQuery(sort_key=REQUEST['sort_key'])" Then feed sort_key into your SQLSelectQuery to use in an ORDER BY clause. select * from table order by dtml-var sort_key You schould never do so. Unquoted variables in SQL-statements are high security risc if they came from REQUEST. As an example someone can send a string which ends a statement and begins a new one, like drop table. Instead reference only an index of a list with the columns to sort. oder by dtml-sqlvar orderindex type=int is also a solution. The index ranges from 1 to number of returned values. Regards Tino You can change the properties of an object in DTML by callling its manage_changeProperties method, for example: dtml-call expr="foo.manage_changeProperties(bar='New Value')" will changes the value of foo's bar property to 'New Value'. There are several ways of getting the effect of assigning variables in DTML, but it really isn't meant to have a direct way of declaring and assigning variables. The way you're trying to use an object's properties will, I believe, cause problems in the case of simultaneous users, because it will act as a global variable. Cheers, Chris On Mon, 4 Dec 2000, John Cappelletti wrote: I am listing the results of a database query using dtml-in. I'd like to be able to give the user the option to re-sort the list by clicking on a column header. ok... I'm starting small with a form and radio buttons to allow the user to specify the sort. I've created what I believe to be a global variable for this page using the property screen. The variable is to capture the column name for the sort. My simple question is how do I assign a value to this variable inside of the dtml method! I'm not finding a description of variable assignment in the documentation (yeah, I must be missing the obvious). Any pointers would be appreciated. (also, know if anyone has implemented interactive sort by column header?) ___ 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] SECURITY alert and hotfix release
On Fri, Dec 08, 2000 at 05:40:13PM -0500, Shane Hathaway wrote: AFAICT 2.1.6 is not vulnerable. Verifying this on our server, this turns out to be quite correct; Zope 2.1.6 does not demonstrate the problem repaired by the hotfix. --amk ___ 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] persistence and dictionaries
Matt [EMAIL PROTECTED] wrote: Chris, this was my original confusion the two places below where you say "You can put instances which do not inherit from Persistence.Persistent in your database. They just won't "stick". They'll hang around until the server is restarted or for an undetermined amount of time during normal operations." "No. It'll work for "a while" or until the server is restarted. :-)" actually do persist after restarts ... that's what confused me, they wouldn't go away and they should!! I think that the confusion here lies in the word, "Peristent". Because it uses the standard Python pickling mechanism, the ZODB can store all kinds of objects (integers, strings, etc., as well as class instances). The ZODB is, however, broken up into a collection of individual records, each of which contains a series of pickles (one per transaction). Objects which are not "ZODB aware" get stored in the pickle of their container (actually, the nearest one which *is* persistence-aware). Deriving your class from Persistence.Persistent says to the ZODB, "put me in my *own* pickle, not it the pickle of my container". The other thing Persistence does is hook the '__setattr__' method, so that changes you make to the object's attributes automatically register it with Zope's transaction machinery; this registration means that a new pickle gets saved to the ZODB at the end of the transaction. Objects which do not derive from Persistence must handle this registration themselves, or else risk having such changes be lost whenever they are reloaded. Globals.PersistentDictionary is a wrapper class which does does this kind of registration in its '__setitem__' method. HTH, Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ 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] customize zope manage_main
I have looked at many of files in lib/python/app and a other folders in the zope installation. I am looking for a way to change the interface a little. I see some recognizable stuff there, but can't figure out how most of the pages are created, how I could change them. I want to add a frame to the edit page so I can submit while editing without refreshing the page. I would have to put a frame and javascript function I wrote,and include below because it is very useful. This makes editing long docs in a textarea tolerable. I use it ona site with a lower framewhere the user can see their changes and not lose their place as they edit/save. thanks, Richard function bgSubmit(frm){frmHide = parent.frames["hidden"].documentvar nd="form name='" + frm.name + "' action='" + frm.action + "' method='" + frm.method + "'"for (i=0;idocument.forms[frm.name].elements.length;++i){elem=document.forms[frm.name].elements[i]if (elem.type=="select-one" || elem.type=="select-multiple"){nd+="select name='" + elem.name + "'"if (elem.type=="select-multiple") {nd+=" multiple "}nd+=""for (x=0;xelem.options.length;++x) {nd+="option "if (elem.options[x].selected) {nd+="selected "}nd+="value='" + elem.options[x].value + "'" + elem.options[x].text + "/option"}nd+="/select"}else if (elem.type=="textarea"){nd +="textarea name='" + elem.name + "'" + elem.value + "/textarea"} else {nd +="input type='" + elem.type + "' name='" + elem.name + "' value='" + elem.value + "'"if (elem.checked){nd+=" checked "}nd+=""}}nd+="/form"frmHide.open("text/html");frmHide.write( nd );frmHide.close();parent.frames["hidden"].document.forms[0].submit()} //this function assume you have a frame named "hidden" and takes a form object as arg, e.g., bgSubmit (window.document.frmToSave)
[Zope] quick python book - question about the feedback form example
Hi, Finally got my hands on The Quick Python book and have read the first 13 chapters. I've now jumped to chapter 26, "Using Zope", to try out some of the examples there. I'm havng a problem with the feedback form example (p326) and I'd be really grateful if someone could point out what I am doing wrong. - I created a directory in the root called 'feedback' and to this I added a DTML document, 'index_html'. I see no probs with this but maybe someone could confirm that the post action is correct for me. index_html - dtml-var standard_html_header FORM ACTION="/cgi-bin/feedback/save_feedback" METHOD="POST" Type of feedback: SELECT NAME="feedback_type" OPTIONCompliment OPTIONCriticism /SELECT p Your comments: TEXTAREA NAME="comments"/TEXTAREA INPUT TYPE="SUBMIT" VALUE="Submit Feedback" /FORM dtml-var standard_html_footer - I then create a python method called 'feedback.py' containing the following: feedback.py -- """feedback.py: A simple feedback form application""" def save_feedback(feedback_type, comments): """ A function to handle submitted feedback form data""" # Open a file for appending to save the feedback # creating the file if necessary try: file=open("feedback_data", "a") except IOError: file=open("feedback_data", "w") # Save the data file.write("Feedback type: %s\n" % feedback_type) file.write("Comments: %s\n\n % comments) file.close() return "Thankyou for your feedback!" ^ On the Python method addition screen I use feedback(.py) as the ID + title and insert "feedback_type, comments" in the parameter list. Of course, this results in an error SyntaxError Invalid token. I tried to modify it by taking out the first 2 lines of the above code, renaming the method 'save_feedback' but still no success. I'm unsure whether the return statement will do anything in Zope also. Can anyone help? - Best regards, Lee (with 10 crossed fingers toes) -- Lee Reilly mailto:[EMAIL PROTECTED] http://www.footkick.co.uk/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] quick python book - question about the feedback form example
Lee I'm no expert, but I thought all Python Scripts [Methods] in Zope need to include 'self' as the first argument. Thus you should try instead """feedback.py: A simple feedback form application""" def save_feedback(self, feedback_type, comments): etc.. among others do check out the ZDP FAQ at http://zdp.zope.org/projects/zfaq/faq/ExternalMethods#952541309 and also the new Zope Book Chapter 8 http://www.zope.org/Members/michel/ZB/ScriptingZope.html [See section about External Python halfway down, but beware the new change in terminology from 'Python Methods' to 'Python Scripts' - slightly out of sync with the Quick Python Book] good luck - Jason ___ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] - Original Message - From: Lee [EMAIL PROTECTED] - I then create a python method called 'feedback.py' containing the following: feedback.py -- """feedback.py: A simple feedback form application""" def save_feedback(feedback_type, comments): """ A function to handle submitted feedback form data""" # Open a file for appending to save the feedback # creating the file if necessary try: file=open("feedback_data", "a") except IOError: file=open("feedback_data", "w") # Save the data file.write("Feedback type: %s\n" % feedback_type) file.write("Comments: %s\n\n % comments) file.close() return "Thankyou for your feedback!" ___ 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] Using Analog and Zope Zserver
Hi All, I'm using analog to analyze my server logs, however I can't figure out how to tell analog to treat everything without an extension as a page. Or perhaps more accurately everything without a "." in it's name. I have read numerous posts to this list regarding index_html or *_html, but much of my site is composed of Zwiki pages, which do not follow that convention. I'm currently playing with the regular expression functions, but I'm not exactly familiar with regex. Any ideas? What is everyone else using when using Zserver, vs. Apache, IIS, etc. Thanks - Scott ___ 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] ZPublisher and func(self,*args,**kw)
On Sat, 9 Dec 2000, Andreas Jung wrote: Inside a product I tried to replace the following function def myfunc(self,arg1='',arg2='',REQUEST=None): by def myfunc(self,*args,**kw): to get a more generic interface. However in every case "args" and "kw" are empty when I output their contents inside the function. Bug or feature ? Zope will only match up arguments from a request with your function arguments when you are specific. It won't just shove everything it can into *args or **kw. -Michel ___ 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] HTTP status code 302
I can view certain document on a Zope site over the web if I use a brower. But for fun I tried to download it by using Python's httplib, and for some Zope sitesgot a status code 302. This probably means I need to use another URL address. The web browser does this automatically so I don't need to do anything. But I can't seem to find the right URL. Reading from http://www.w3.org/Protocols/HTTP/HTRESP.html, it says that when 302 happens, the header line would be URI: url String CrLf But I don't see this line in the returned header. And the returned body is an HTML telling me the document has been moved. Funny thing is thatbrowsers (IE, Netscape) do not have problems with it. Is this a limitation of Python's httplib (not showing the URI in the response header)? Is therea way to circumvent it? Or does this have to do with virtual hosting, or Apache stuff? Thanks, Hung Jung
Re: [Zope] Failed upgrade to 2.2.4 - solutions?
Luke Tymowski writes: like so in my z2.py? it didn't do anything. But I can get a python core dump! If you get a core dump, then use a debugger to look into it. This can give you valuable glues wrt the cause of the problem. Dieter ___ 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] persistence and dictionaries
This makes sense with some of my experimentation. So I am correct to assume now that any member classes that I include into my Product that don't themselves derive from Persistence.Persistent will become pickled into my products pickle, and will do whenever __setattr__ method of my product is called. I am wondering if this also answers my question in my very last email titled Re: [Zope] persistence and dictionaries - new light where I found that anything called within my manage_edit(self, title, REQUEST=None) method was persisted, but that if I did the same things in another method(also in the Product) and called that method from a dtmlMethod then things would not be persisted. thanks for all the help from everyone, this is really invaluable. regards Matt Tres Seaver wrote: Matt [EMAIL PROTECTED] wrote: Chris, this was my original confusion the two places below where you say "You can put instances which do not inherit from Persistence.Persistent in your database. They just won't "stick". They'll hang around until the server is restarted or for an undetermined amount of time during normal operations." "No. It'll work for "a while" or until the server is restarted. :-)" actually do persist after restarts ... that's what confused me, they wouldn't go away and they should!! I think that the confusion here lies in the word, "Peristent". Because it uses the standard Python pickling mechanism, the ZODB can store all kinds of objects (integers, strings, etc., as well as class instances). The ZODB is, however, broken up into a collection of individual records, each of which contains a series of pickles (one per transaction). Objects which are not "ZODB aware" get stored in the pickle of their container (actually, the nearest one which *is* persistence-aware). Deriving your class from Persistence.Persistent says to the ZODB, "put me in my *own* pickle, not it the pickle of my container". The other thing Persistence does is hook the '__setattr__' method, so that changes you make to the object's attributes automatically register it with Zope's transaction machinery; this registration means that a new pickle gets saved to the ZODB at the end of the transaction. Objects which do not derive from Persistence must handle this registration themselves, or else risk having such changes be lost whenever they are reloaded. Globals.PersistentDictionary is a wrapper class which does does this kind of registration in its '__setitem__' method. HTH, Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ 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 )
[Zope] ZClass with images
Anyone know how to put some images in ZClass? I have done things like putting ZClass with base class OFS:Image but with it I can only assing one Image do the object... I need to assign two or tree images do the object. Thanks... -- Diego Rodrigo Neufert Webmaster / Web Developer - Magic Web Design --- [EMAIL PROTECTED] www.magicwebdesign.com.br Curitiba - PR - Brasil ___ 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] zcatalog, zclass instances
Hello, I am building a small community site. I am building the login/signup system. I have a problem with the creation of new users on signup. I have a users zclass which is catalog aware. I used the job board tutorial to set it up (thanks! very useful documentation) When I a user signs up I search the catalog for their username, because I want to keep that unique. here is the code: Content-type: application/x-www-form-urlencoded dtml-in Catalog _root.feedback=sorry+name+taken dtml-if sequence-end /dtml-if sequence-end dtml-else dtml-var add_user_dtml /dtml-in This page is passed the variable "username". This works to catch existing usernames most of the time. However, in a few cases it will miss the fact that the name matches an existing name and go ahead to the dtml-var add_user_dtml page: dtml-call "REQUEST.set('password', signuppassword)" dtml-call "REQUEST.set('username', username)" dtml-with "manage_addProduct['swatchuser']" dtml-call "swatchuser_add(_.None, _, NoRedir=1)" /dtml-with _root.feedback=success This code usually successfully adds a new user. However if the username is a duplicate (it shouldn't arrive at this page, but if it does) it will only successfully make a new zclass instance of the user if they are a single letter long Thus I get a user list that looks like this: max , yay , josh , mary , peter , john , ann , dog , cat , badger , fork , g , k , ww , u , u , u , u , u , b , u , erm , frog , erk , damn , erkf , this , bg , q , q , e , u , aname , j , j , j , j , j , j , j , j , j , j , amy , y , y , y So for single letter names the user signs up no matter whether someone else has that name or not. Which is not what I want. But the problem does not end their, else I would just not permit one letter name. For those who choose names of more than one letter, they may be told that they have successfulluy created a new user when they haven't. The times when this happens are usually if I haven't closed and opened the browser between sign-ups. However it happens seemingly randomly. I am calling all this code from a flash file in the same directory. I have the same thing working using zope and SQL no problem, but can't work it out with zcatalog. Unfortunately I need to! My first inuitions are that: 1: it has something to do with the pages being cached. 2: I am not updating the catalog properly, though I added the lines suggested in the job board tutorial to the add method of the zclass: dtml-call reindex_object Any hints will be appreciated... I think I may be reporting the same problem that is mentioned in: http://www.egroups.com/message/zope/44901 but I am not sure. thanks for your time josh on === write: [EMAIL PROTECTED] read: www.futurefarmers.com read: www.crd.rca.ac.co.uk/~josh interrupt (i love it): (415) 552 2124 = ___ 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 )