[Zope] Quesiton about retrieving the base object
Hello, I have a custom product that has a ZFile as its base class. I tried importing the file on the upgraded platform, but I got the "Operation not supported" error. I have a ton of these objects that show up as "broken". Question: I still have my old Zope server running, is it possible to extract the files as regular Zope Files so I can transfer them over? Maybe make a python script? Thanks. RA - Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.___ 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] dictionary from sequence-item
Thanks,I tried your suggestion Jonathan and I get this:Error Type: AttributeError Error Value: has_keyThanks anyway.I never used ZPT, I'm not sure how to approach it from that angle...would it be easy to do? (You mean tal and metal right?)Anyone have any other suggestions?ThanksJonathan <[EMAIL PROTECTED]> wrote: It might make your life easier if you used a dtml-let (WARNING: untested): do something here But this is still pretty ugly. Another approach would be to clean up the data in your list/dicts within the python script, before you get to the dtml method. Jonathan - Original Message - From: AlricAneronTo: zope@zope.orgSent: Monday, June 19, 2006 2:46 PM Subject: [Zope] dictionary fromsequence-item Hello,I am looping through a list of dictionary objectsusing and within the dtml-in body I have:Some of thedictionaries in the list don't have 'titled' key so it should replace it withthe word "none", but it gives me an errorError Type: KeyErrorError Value: 'titled'I don'tunderstand. Another option is that I can use but it doesn't work, sayshas_key is an unknown attribute. This is the stupidest thing ever! it'sa dictionary object!I try to typecast it using thedict(_.getitem('sequence-item')).has_key('titled') it gives me an error sayingit can't typecast, but I am 100% sure it's a dictionary object because I canaccess it easily _.getitem('sequence-item')['titled'] for those that have thatkey.Any idea how I can check if the titled key is in the dictionaryfor the current list item?Thanks in advance guys! Yahoo!Messenger with Voice. PC-to-Phone calls for ridiculously low rates. ___Zope maillist - Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev) Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.___ 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] dictionary from sequence-item
Hello,I am looping through a list of dictionary objects using and within the dtml-in body I have:Some of the dictionaries in the list don't have 'titled' key so it should replace it with the word "none", but it gives me an errorError Type: KeyError Error Value: 'titled' I don't understand. Another option is that I can use but it doesn't work, says has_key is an unknown attribute. This is the stupidest thing ever! it's a dictionary object!I try to typecast it using the dict(_.getitem('sequence-item')).has_key('titled') it gives me an error saying it can't typecast, but I am 100% sure it's a dictionary object because I can access it easily _.getitem('sequence-item')['titled'] for those that have that key.Any idea how I can check if the titled key is in the dictionary for the current list item?Thanks in advance guys! Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.___ 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] converting Dictionary to Result
Thanks,Here is what I'm trying to do:Let's say:contents of myscript():mydict = {'key1': 'value1', 'key2': 'value2'}mydict2 = {'key1': 'value3', 'key2': 'value4'}finalList = [mydict, mydict2]return finalListWhen I do this in a dtml-method: This will not return me this:value1value2It gives me a key error.However if I loop through a recordset, it produces proper output.I'd like to merge a record object and a dictionary object so I can access them like I showed you here with dtml-in - so I can loop over both of them.Is there a way?Thanks in advance guys!Andreas Jung <[EMAIL PROTECTED]> wrote: --On 19. Juni 2006 09:16:23 -0700 Alric Aneron <[EMAIL PROTECTED]> wrote:> Hello,> I have a dictionary object and a result set object (that was returned> from a ZSQL method). Is there any way I can merge them into one variable> and use them in a dtml-in statement?>result sets have a dictionaries() method and dict have an update() method..everything else is one-liner-Python magic and depends on your usecase.-aj-- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 T�bingen - GermanyWeb: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376E-Publishing, Python, Zope & Plone development, Consulting Yahoo! Sports Fantasy Football 06 - Go with the leader. Start your league today! ___ 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] converting Dictionary to Result
Hello,I have a dictionary object and a result set object (that was returned from a ZSQL method). Is there any way I can merge them into one variable and use them in a dtml-in statement?Thanks in advance. Yahoo! Sports Fantasy Football 06 - Go with the leader. Start your league today! ___ 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] Zope Recordset Object
Hello, I have a ZSQL Method, which is called by my python script. However, I am curious as to what type of object is returned when that call is made. It's some sort of a recordset (or resultset) object that behaves like a list...it doesn't seem to be a dictionary object though, but I can't find any object reference on it. I tried using rs.keys() but it says that method doesn't exist in that class. Does anyone have a member function list (object reference ) that's associated with this resultset or can tell me what kind of object is returned? I gave up on google, couldn't find anything on it. Thank you in advance! __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ 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] dtml forwarding request
So there is no way to do it through python and DTML?I know Java has something like that.Jonathan <[EMAIL PROTECTED]> wrote: If you are using a zeo server and both server are zeo clients you could store the info on the zeo server, then do a redirect from serverA/methodA to serverB/methodB. If the servers do not have access to the same zeo server, then you are going to have to 'package-up' all the variables you need and send them to serverB/methodB Depending on what is happening in serverB/methodB you could just do some kind of rpc from serverA/methodA to serverB/methodB (ie. methodA just sends a request to methodB, which does some processing and sends the results back to methodA for final processing/display). It's kind of hard to guess what would be best without knowing more about the application(s). Jonathan - Original Message ----- From:AlricAneronTo: Jonathan ; zope@zope.orgSent: Thursday, June 08, 2006 4:31PM Subject: Re: [Zope] dtml forwardingrequest The dtml_method where I want to forward to is on anotherserver, so your may would be a little hard to do. Sorry, I didn't makemyself clear the first time.Thanks, anysuggestions?Jonathan <[EMAIL PROTECTED]> wrote: if you want to go straight from one dtml routine to another just use dtml-var (ie. have dtml method A call dtml method B) - then in dtml method A have: This will 'pass' control and the REQUEST space from A to B. Is this is not what you are looking for, then provide some more info as to your use case. Jonathan-Original Message -----From:AlricAneronTo:zope@zope.org Sent:Thursday, June 08, 2006 4:22 PM Subject:[Zope] dtml forwarding request Hello,Is there a way in Zope to forward a request fromone page to another. When I say "forward" a request, I want toretain all the GET and POST request parameters. So similar to but response.redirectloses all the request parameters.I've been looking around and couldn't find it.Any ideas?Thanks in advance! Yahoo! Groups gets better. Checkout the new email design. Plus there�s much more to come. ___Zopemaillist - Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev) Sneak preview the all-newYahoo.com. It's not radically different. Just radically better. Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. ___ 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] dtml forwarding request
The dtml_method where I want to forward to is on another server, so your may would be a little hard to do. Sorry, I didn't make myself clear the first time.Thanks, any suggestions?Jonathan <[EMAIL PROTECTED]> wrote: if you want to go straight from one dtml routine to another just use dtml-var (ie. have dtml method A call dtml method B) - then in dtml method A have: This will 'pass' control and the REQUEST space from A to B. Is this is not what you are looking for, then provide some more info as to your use case. Jonathan- Original Message ----- From:AlricAneronTo: zope@zope.orgSent: Thursday, June 08, 2006 4:22PM Subject: [Zope] dtml forwardingrequest Hello,Is there a way in Zope to forward a request from onepage to another. When I say "forward" a request, I want to retain allthe GET and POST request parameters. So similar to but response.redirect loses all therequest parameters.I've been looking around and couldn't find it.Anyideas?Thanks in advance! Yahoo! Groups gets better. Checkout the new email design. Plus there�s much more to come. ___Zope maillist - Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev) Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. ___ 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] dtml forwarding request
Hello,Is there a way in Zope to forward a request from one page to another. When I say "forward" a request, I want to retain all the GET and POST request parameters. So similar to but response.redirect loses all the request parameters.I've been looking around and couldn't find it.Any ideas?Thanks in advance! Yahoo! Groups gets better. Check out the new email design. Plus theres much more to come. ___ 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] LAST INSERT ID driving me crazy
Hi guys, HOW HOW HOW HOW!!! Do I get at the last_insert_id() function, this is driving me absolutely crazy!! Zope docs say use "select last_insert_id()" but it doesn't work, gives me an error about bad SQL syntax around "LIMIT 1000". I tried googling it, I tried searching through other docs. And it just won't do it! I would like to make a separate ZSQL Method that will return to me the last insert id. Any help would be appreciated. Thank you. Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.___ 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] External Methods newbie question
thanks guys, I'll tryAndreas Jung <[EMAIL PROTECTED]> wrote: --On 28. Februar 2006 20:26:13 -0500 Jonathan <[EMAIL PROTECTED]> wrote:>> python has a command called 'commands' which can be used for executing> bash commands.talk about modules, not commands.-aj Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. ___ 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] External Methods newbie question
Hello,I see I can only execute python functions in external methods. Is there any way to execute the whole file, not just a certain function? In linux I created a python script, and it doesn't have functions. I just want to execute the whole file. I tried using "self" or "init" for function names in Zope and it doesn't want to do it, telling me "The specified object, init, was not found in module, test."Is there a way to execute a file?(another question: is there a way to execute bash commands in linux? or is external methods only good for python?)Thanks in advance guys!! Yahoo! Mail Use Photomail to share photos without annoying attachments.___ 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] Zope background variables
Hello, I was wondering if there is a way to store a global variable on the server, and have such variable be easily retrieved in Zope dtml/python methods. I want to make my own login system with sessions. And store session ID on the server and cookie to identify logged in users. Is there an easy way to store a list of users and session IDs on the server? Like a background array that's always available as long as the server is running. Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP.___ 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] newbie dtml-in question objectValues
thats exactly what I need, thank you!David H <[EMAIL PROTECTED]> wrote: Alric Aneron wrote: Hello, I am trying to find how to get the relative path of an object. If i do: URLPATH0 does not give me the relative path of the objects interated, but rather the path of the object doing the iterating (my method). I want the path of every DTML Document the loop encounters. absolute_url works, but it puts in the undesired filename and "http://" in front etc. Thanks in advance! Al Alric, This is a python example. I dont want to convert to dtml but maybe you do. for o in container.objectValues('DTML Method'): print o.virtual_url_path() return printed Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___ 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] newbie dtml-in question objectValues
Hello, I am trying to find how to get the relative path of an object. If i do: URLPATH0 does not give me the relative path of the objects interated, but rather the path of the object doing the iterating (my method). I want the path of every DTML Document the loop encounters. absolute_url works, but it puts in the undesired filename and "http://" in front etc. Thanks in advance! Al Yahoo! Photos Showcase holiday pictures in hardcover Photo Books. You design it and well bind it!___ 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] Help with Zope Python result object please!
Thank you sir! Sorry, I am very new to python. It's quite unlike other languages. Happy new year! AlDavid H <[EMAIL PROTECTED]> wrote: Alric Aneron wrote: hello, I have a python code that recieves two result objects from two different ZSQL methods. I need to join them (sort of like UNION). I can't do result1+result2, otherwise it raises an exception that the + operator isn't supported. When I try to do this (read below, I explained what i've done if you are lazy to read the code) result1 = context.zsqlmethod1() result2 = context.zsqlmethod2() if (len(result1) == 0): return resu lt2 row1 = 0 row2 = len(result1) + 1 col = 0 for r in result2: col = 0 if (context.duplicateExists(result1, result2[row1][0]) == -1): result1[row2][col] = result2[row][col] col = col + 1 row1 = row1 + 1 row2 = row2 + 1return result1Basically, it loops through the rows and columns of result2 and adds them to the end of th e result 1. However it for some reason raises "index out of range" and says that assigning result1[0][0]=result2[0][0] (if there is an element in both of them) is illegal because: Error Value: object does not support item or slice assignment I realize that in most programming languages you can't add them to result1 without resizing it first, but I can't find much documentaiton on member functions of the result object, so I can't resize it. I am completely stuck, I've tried everything, spent so much time on it, can anyone please help save my sanity :PThanks in advance guys! I really appreciate it.Y Alric, The merging of two zsql result sets is easy - here's one way: newResults = [] for r in resultset1: newResults.append( r ) for r in resultset2: newResults.append( r ) return newResults. David Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___ 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] Help with Zope Python result object please!
hello, I have a python code that recieves two result objects from two different ZSQL methods. I need to join them (sort of like UNION). I can't do result1+result2, otherwise it raises an exception that the + operator isn't supported. When I try to do this (read below, I explained what i've done if you are lazy to read the code) result1 = context.zsqlmethod1() result2 = context.zsqlmethod2() if (len(result1) == 0): return result2 row1 = 0 row2 = len(result1) + 1 col = 0 for r in result2: col = 0 if (context.duplicateExists(result1, result2[row1][0]) == -1): result1[row2][col] = result2[row][col] col = col + 1 row1 = row1 + 1 row2 = row2 + 1 return result1 Basically, it loops through the rows and columns of result2 and adds them to the end of th e result 1. However it for some reason raises "index out of range" and says that assigning result1[0][0]=result2[0][0] (if there is an element in both of them) is illegal because: Error Value: object does not support item or slice assignment I realize that in most programming languages you can't add them to result1 without resizing it first, but I can't find much documentaiton on member functions of the result object, so I can't resize it. I am completely stuck, I've tried everything, spent so much time on it, can anyone please help save my sanity :P Thanks in advance guys! I really appreciate it. Yahoo! DSL Something to write home about. Just $16.99/mo. or less___ 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] Please help with DTML-in (newbie)
thanks you all!! This helped a lot!Tino Wildenhain <[EMAIL PROTECTED]> wrote: J Cameron Cooper schrieb:> Alric Aneron wrote:> >> Hello, I am new to Zope and DTML.>> I am trying to use a python script to call a Z SQL method. The python>> script also has a list that >> over. so my python script:>> -python script>> words = ['one', 'two']>> context.REQUEST.set('wordlist', wordlist)>> rs = context.myzsqlmethod()>> return rs[0,2]>> -z sql script:>> SELECT * FROM table>> WHERE>> >> column1 LIKE ('' OR>> column2 LIKE '') >> sequence-end> AND >> And dont use in ZSQL Methods.In your example, use instead.Even if you hardcode the wordlist, but even more if its comingfrom request somewhere. Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___ 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] Please help with DTML-in (newbie)
Hello, I am new to Zope and DTML. I am trying to use a python script to call a Z SQL method. The python script also has a list that -python script words = ['one', 'two'] context.REQUEST.set('wordlist', wordlist) rs = context.myzsqlmethod() return rs[0,2] -z sql script: SELECT * FROM table WHERE column1 LIKE ('' OR column2 LIKE '') AND--- But it doesn't want to, gives me.. Error Type: NameErrorError Value: name 'wordlist' is not defined I tried feeding the variable into the ZSQL arguments list, but i got something like "cannot concatenate a module with a str" Can a nyone please help me? Thank you! Yahoo! Shopping Find Great Deals on Holiday Gifts at Yahoo! Shopping ___ 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 )