[Zope] adding value to the path
When I submit this: input name=branch/manage_editProperties:method type=submit class=form-element value=Save Changes / It works very nicely. I'd like the user to choose the page to amend so I have a select option to choose the page (in this case the one named 'branch' select size=3 width=100 name=pageName dtml-in getParentNode().objectItems('DTML Document') dtml-if id() != 'index_html' dtml-if id() != 'editProperties' option value=dtml-var id dtml-var title_or_id/option /dtml-if /dtml-if /dtml-in /select And I think this ought to work.. but it doesn't... input name=document.propForm.pageName.value+/manage_editProperties:method type=submit class=form-element value=Save Changes / It does absolutely nothing. How do I pass it the value to the input name? Katie ___ 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] adding value to the path
Thanks for the clean-up - I was trying and not getting anywhere. That said, using the text field as an input method and then passing it on doesn't work either. input name=id+/manage_editProperties:method type=submit class=form-element value=Save Changes / If it helps - I'd like the user to be able to modify the properties of a DTML Document that they choose from a single edit form. I'm fine if I specify the path but I need them to add the page name to the path, hence the addition before the /manage_editProperties:method Katie -Original Message- From: Jonathan [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 13, 2007 3:49 PM To: Kate Legere; zope@zope.org Subject: Re: [Zope] adding value to the path - Original Message - From: Kate Legere [EMAIL PROTECTED] To: zope@zope.org Sent: Tuesday, February 13, 2007 3:38 PM Subject: [Zope] adding value to the path When I submit this: input name=branch/manage_editProperties:method type=submit class=form-element value=Save Changes / It works very nicely. I'd like the user to choose the page to amend so I have a select option to choose the page (in this case the one named 'branch' select size=3 width=100 name=pageName dtml-in getParentNode().objectItems('DTML Document') dtml-if id() != 'index_html' dtml-if id() != 'editProperties' option value=dtml-var id dtml-var title_or_id/option /dtml-if /dtml-if /dtml-in /select And I think this ought to work.. but it doesn't... input name=document.propForm.pageName.value+/manage_editProperties:method type=submit class=form-element value=Save Changes / It does absolutely nothing. How do I pass it the value to the input name? You create a separate html input tag that gets the information you require from the user, eg Enter Id: input type=text name=id:UTF-8:string size=30 value=/ If you already have some information that you want to pass along to the receiving method (ie. this information does not come from user input) then use a hidden input: input type=text name=id:UTF-8:string size=30 value=dtml-var someIdvar/ P.S. i just couldn't let this go: dtml-if id() != 'index_html' dtml-if id() != 'editProperties' option value=dtml-var id dtml-var title_or_id/option /dtml-if /dtml-if is simpler as: dtml-if id() != 'editProperties' and id() !=index_html option value=dtml-var id dtml-var title_or_id/option /dtml-if Jonathan ___ 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] sorting
I'd like to sort the items in a folder by relevance, relevance being a property I've assigned. I'm using a python script for aj in ao.objectItems(items): aao=aj[1] #the object title=aao.title id=aj[0] aanum=len(aao.objectIds()) if ( aanum 1 ): if (title != '' and id != 'index_html' and not o.hasProperty('display')): ret=ret # + li id=ul_+id+ else: if (title != '' and id != 'index_html' and not o.hasProperty('display')): ret=ret # + li id=ul_+id+ class=closed1 if (title != '' and id != 'index_html' and not o.hasProperty('display')): ret=ret+li id=ul_+id+h3a href=\+aao.absolute_url()+\nbsp;nbsp;nbsp;+title+/a/h3/li\n . When I try values=ao.objectItems(items) values.sort(lambda a,b: cmp(a[0],b[0])) for aj in values: aao=aj[1] #the object title=aao.title Error Type: AttributeError Error Value: 'tuple' object has no attribute 'sort' Obviously, id isn't really what I wanted to sort by anyway but since I can't even do that I can't really go on to try to use getattr to try and sort on relevance.. Kate The full trackback in case anyone wants it is.. Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module OFS.DTMLDocument, line 128, in __call__ - DTMLDocument at /kfplsite/redesign/aboutLibrary/index_html - URL: http://www2.kfpl.ca:8080/kfplsite/redesign/aboutLibrary/index_html/manage_ma in - Physical Path: /kfplsite/redesign/aboutLibrary/index_html Module DocumentTemplate.DT_String, line 476, in __call__ Module OFS.DTMLDocument, line 121, in __call__ - DTMLDocument at /kfplsite/redesign/menuLeft used for /kfplsite/redesign/aboutLibrary - URL: http://www2.kfpl.ca:8080/kfplsite/redesign/menuLeft/manage_main - Physical Path: /kfplsite/redesign/menuLeft Module DocumentTemplate.DT_String, line 476, in __call__ Module OFS.DTMLMethod, line 137, in __call__ - DTMLMethod at /kfplsite/redesign/pythonLeftMenu used for /kfplsite/redesign/menuLeft - URL: http://www2.kfpl.ca:8080/kfplsite/redesign/pythonLeftMenu/manage_main - Physical Path: /kfplsite/redesign/pythonLeftMenu Module DocumentTemplate.DT_String, line 476, in __call__ Module DocumentTemplate.DT_Util, line 196, in eval - __traceback_info__: redesign Module string, line 1, in expression Module Shared.DC.Scripts.Bindings, line 311, in __call__ Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec Module Products.PythonScripts.PythonScript, line 323, in _exec Module None, line 65, in pythonLeftMenuKatie2 - PythonScript at /kfplsite/redesign/pythonLeftMenuKatie2 used for /kfplsite/redesign/menuLeft - Line 65 AttributeError: 'tuple' object has no attribute 'sort' ___ 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] attribute-less object(assign or del)
It turned out, actually to be easier than I though to correct this - I ended up trapping the exception whenever one occurred. Thanks for all the input. Katie -Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED] Sent: Sunday, December 17, 2006 4:25 AM To: Kate Legere Cc: zope@zope.org Subject: RE: [Zope] attribute-less object(assign or del) Kate Legere wrote at 2006-12-11 09:31 -0500: This is the full trackback: Site Error Log Site Error Log at /error_log Exception traceback Time 2006/12/11 09:26:04.451 US/Eastern User Name (User Id)[EMAIL PROTECTED] ([EMAIL PROTECTED]) Request URL http://staffnet.kfpl.ca:8080/kfplStaff/statsTracker/display/copy_of_stats_o u tput_branch Exception Type TypeError Exception Valueattribute-less object (assign or del) PythonScript at /kfplStaff/statsTracker/display/copy_of_stats_output_branch Line 45 * Module RestrictedPython.Guards, line 96, in handler TypeError: attribute-less object (assign or del) This gives us another two potential problem causes. * It is likely that you cannot change 'Record' attributes in restricted code (such as in 'PythonScript'). Try in trusted code (e.g. an ExternalMethod). * Maybe, you try to change not a Record instance (a single hit) but the Result instance (representing the complete result list). Result instances do not have any writable attributes. -- Dieter ___ 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] change manage_addFile
I copied the code from manage_addFileFolder so that we can upload files into the filesystem but I'd like to amend it so that we can specify the target folder rather than just having the file uploaded to the folder in which the form resides. How would I do that? I've looked through the code in OFS that handles this but am not sure how to add the folder as a variable (I;ve tried a couple of things unsuccessfully) manage_addFileForm=HTMLFile('dtml/imageAdd', globals(),Kind='File',kind='file') def manage_addFile(self,id,file='',title='',precondition='', content_type='', REQUEST=None): Add a new File object. Creates a new File object 'id' with the contents of 'file' id=str(id) title=str(title) content_type=str(content_type) precondition=str(precondition) id, title = cookId(id, title, file) self=self.this() # First, we create the file without data: self._setObject(id, File(id,title,'',content_type, precondition)) # Now we upload the data. By doing this in two steps, we # can use a database trick to make the upload more efficient. self._getOb(id).manage_upload(file) if content_type: self._getOb(id).content_type=content_type if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') Katie ___ 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] want to get the url in python script
I'm getting an attribute error finding pyUrlQuote from this: quote = context.pyUrlQuote Is there another way I can get the url? Has this been replaced? Katie ___ 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] attribute-less object(assign or del)
Module None, line 45, in copy_of_stats_output_branch PythonScript at copy_of_stats_output_branch Line 45 for j in self.sql.sqlGetStatDetailsSum(date1=i.date, branch1=i.branch, category1=i.category, timeCheck1=k): if str(j.sum_renewals)== 'None': line 45 -- j.sum_renewals = 0 elif str(j.sum_registrations)== 'None': j.sum_renewals = 0 elif str(j.sum_hours)== 'None': j.sum_renewals = 0 elif str(j.sum_reference)== 'None': j.sum_renewals = 0 When I have values returned by the sql call it works fine but as soon as I get to a field that has a 0 in it then I get an error... As far as I can tell I'm doing the assignment correctly ... what's wrong here? Kate ___ 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] attaching an image to an email
Nope, I still don't get the attachment. Katie -Original Message- From: Jonathan [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 28, 2006 3:55 PM To: Kate Legere; zope@zope.org Subject: Re: [Zope] attaching an image to an email - Original Message - From: Kate Legere [EMAIL PROTECTED] To: zope@zope.org Sent: Wednesday, June 28, 2006 4:05 PM Subject: [Zope] attaching an image to an email I'm writing a form which allows the user to send an image attachment with their email... form method=post action=sendPic ENCTYPE=multipart/form-data pAttach: input type=file name=pic.jpg/p pSend to:/p p input type=checkbox name=send_to:list value=[EMAIL PROTECTED] My email /p input type=submit value=Send Picture /form -- it's handled with sendPic --- dtml-sendmail smtphost=mail.host.ca To: art critic From: patron Subject: Art Hi, please take a look at my art and post it if you think it's good enough. dtml-mime type=image/jpeg encode=base64 name=resumedtml-var pic.jpg /dtml-mime /dtml-sendmail pYour image was sent./p - but it only delivers --- Hi, please take a look at my art and post it if you think it's good enough. Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=192.168.10.45.502.995.1151524502.277.30154 --192.168.10.45.502.995.1151524502.277.30154 Content-Type: image/jpeg; name=pic.jpg Content-Transfer-Encoding: base64 PFpQdWJsaXNoZXIuSFRUUFJlcXVlc3QuRmlsZVVwbG9hZCBpbnN0YW5jZSBhdCAweDkzNjFmZDQ+ CiAg - What am I doing wrong? This how-to may help: http://www.zope.org/Members/visibleoffice/HowTo.2003-10-22.1455 Jonathan ___ 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] attaching an image to an email
I get a result like : Cv/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAHBAQEBQQHBQUHCgcFBwoMCQcHCQwNCwsMCwsNEQ0N DQ0NDRENDxAREA8NFBQWFhQUHh0dHR4iIiIiIiIiIiIi/9sAQwEIBwcNDA0YEBAYGhURFRogICAg ICAgICAgICAgISAgICAgICEhISAgICEhISEhISEhIiIiIiIiIiIiIiIiIiIi/8AAEQgGggXsAwER AAIRAQMRAf/EABwAAAMBAQEBAQEBAgMEBQYHCP/EAD8QAAICAgEDAwMDAwMDBAEA CwABAhEDITEEEkEFUWETInEGMoEUQpEVobEHI1IzYsHRFuHxJDRyFyVDgvCS/8QAGwEBAQEBAQEB AQAAAQIAAwQFBgf/xAAmEQEBAQEAAwEBAQEAAgMBAQEAARECEiExA0EEE1FhFCIyQgVx /9oADAMBAAIRAxEAPwDcrUANTIToYo6fIxg2gaQnoRTS+2w1NNcDqp8F+QtEinXv/Bt00d3KDGh9 y7fk2e04Nsel4EESHvYkl3XZg1jmlEkto541tCS7YSdozMc0EjajqM1Ois1pVLKQ6ah5P8lSJp4m Zl2ONafdRsCO9sLG1dU9GI+4cbQrMxXT4MTUv8mwYrXkNaG6H+mnYW+xaYX22l5HGJOXDGBbQ4yd 0Ta2ntCQ/kGCUTWsONBp6p1E2Jg4M0+jRRPlEYDVUUqlHgYLRFhcjG3oolbS0DWm+QiaezMSsMOG noWGgow0xjYTZoo6sqAqJY3wMmjB4sabDRIgQnAFbQjUGkbGIY2m6s2qGgtTgAhsrG1VLySaRX8T h34omGk03+CgS5GqPkIxpsbQf/JNY+NmlYas0OEmr2UIewgI1UafkGlCEAW0GY7XsZh4J1tFeSrT gdoxweTYB/cDaO73MKfd7CcLkax+CAEJH1ci/BsGj+qjwwxpSeaNa5EpUm2ONYuKfINFXQtTsAX4 GNqqsKxPRoQYWn8oohvRFgBQPYqFEsH8mBxoxLjYwDnbMSMDS9zaSto0B2mT8po2uB6ZX1J0iQpZ ... it's longer but you get the picture. Katie -Original Message- From: Berthold Stöger [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 1:07 AM To: zope@zope.org Cc: Kate Legere Subject: Re: [Zope] attaching an image to an email Hi, On Wednesday 28 June 2006 22:05, Kate Legere wrote: dtml-sendmail smtphost=mail.host.ca To: art critic From: patron Subject: Art Hi, please take a look at my art and post it if you think it's good enough. dtml-mime type=image/jpeg encode=base64 name=resumedtml-var pic.jpg /dtml-mime /dtml-sendmail Try: dtml-sendmail smtphost=host To: to From: from Subject: Art dtml-mime type=text/plain encode=7bit Hi, please take a look at my art and post it if you think it's good enough. dtml-boundary type=image/jpeg encode=base64 name=resumedtml-var REQUEST['pic.jpg'].read() /dtml-mime /dtml-sendmail Of course this doesn't work if the user uploads a non-jpeg picture therefore some more elaborated code will be needed. HTH ___ 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] attaching an image to an email
I'm writing a form which allows the user to send an image attachment with their email... form method=post action=sendPic ENCTYPE=multipart/form-data pAttach: input type=file name=pic.jpg/p pSend to:/p p input type=checkbox name=send_to:list value=[EMAIL PROTECTED] My email /p input type=submit value=Send Picture /form -- it's handled with sendPic --- dtml-sendmail smtphost=mail.host.ca To: art critic From: patron Subject: Art Hi, please take a look at my art and post it if you think it's good enough. dtml-mime type=image/jpeg encode=base64 name=resumedtml-var pic.jpg /dtml-mime /dtml-sendmail pYour image was sent./p - but it only delivers --- Hi, please take a look at my art and post it if you think it's good enough. Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=192.168.10.45.502.995.1151524502.277.30154 --192.168.10.45.502.995.1151524502.277.30154 Content-Type: image/jpeg; name=pic.jpg Content-Transfer-Encoding: base64 PFpQdWJsaXNoZXIuSFRUUFJlcXVlc3QuRmlsZVVwbG9hZCBpbnN0YW5jZSBhdCAweDkzNjFmZDQ+ CiAg - What am I doing wrong? Kate ___ 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] does anyone know of something like this
I develop for a library and wanted to know if there was a zope product that might accomplish what we're looking for before we build it ourselves. We have a number of book club sets that are loaned out to patrons for a 6 week period. The way in which this differs from our regular collection is that patrons can reserve a set by date rather than just joining a waiting list. Right now the way it works is almost beyond belief in it's complexity and archaic-ness. As I say, we can build an application that will handle this but it seems like it might be a common enough situation that if there was already something out there that we could just modify we might be better off doing that. Kate ___ 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] probably a simple answer...
So this probably has a simple answer but if someone could direct me it would save lots of time ... I have a python script that gets called from a dtml method and returns the information requested from a mySql database and opens it as an excel file. I'd like it also to save the file (it can safely overwrite the existing file) ... how do I do this? ---the python script has request = container.REQUEST RESPONSE = request.RESPONSE table_example = -- html table formatting tags and python code to get the info from the database -- RESPONSE.setHeader(Content-type,application/vnd.ms-excel) RESPONSE.setHeader(Content-disposition,attachment;filename=statsSpreadshe et.xls) return table_example - Kate ___ 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] probably a simple answer..
Not really.. Ideally, I'd like the script just to save the file to a pre-selected path. Then anyone can open it from there. Kate -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, November 17, 2005 12:14 PM To: zope@zope.org Subject: Re: [Zope] probably a simple answer.. I'm thinking Kate means that she is writing to an Excel file on a Zope/Windows server, acting as a simple database, perhaps via ODBC. Kate can you clarify what you are trying to do? Thanks. -- Harlow Pinson Indepth Learning Email: [EMAIL PROTECTED] Phone: 505 994-2135 Fax: 505 994-3603 ___ 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 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] probably a simple answer..
Well, we're working on porting it over from linux but at the moment that's my only option... I just had this impression that I'd seen something whereby I could write to the filesystem using an external method. Kate -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 1:06 PM To: Kate Legere; zope@zope.org Subject: RE: [Zope] probably a simple answer.. Well, I can suggest how I might approach it, which might be different than what you intend... but for what it is worth... First, run Zope on a Windows server so you can interact with an Excel file as an ODBC Data Source (DSN). You could setup a Zope/ODBC adaptor Product like zodbc or (better) mxODBC in Zope. Then in Windows control panel, setup an ODBC DSN to the Excel file, and create a Zope/ODBC connection in the ZMI. Then you might be able to use ZSQL methods, or Python if you perfer, perhaps using SQL or the Windows API, to write to the Excel spreadsheet. You might have to use some sort of external file storage for the Excel file, i.e. I'm not sure how you could store the Excel file in the ZODB and still interact with it and expose it through Zope, though that might be possible. Like Andreas said, you can't write to a users file system directly, if that's what you meant. -- Harlow Pinson Indepth Learning Email: [EMAIL PROTECTED] Phone: 505 994-2135 Fax: 505 994-3603 ___ 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] msSql and python
I have a zsql method to which I want to pass and argument. Normally I do it from a dtml method and the use something like this to test for equality. WHERE description = dtml-sqlvar description type=string. However, I'm passing the variable from a python script and it won't accept the dtml tag what do I put in the equality test? Kate ___ 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] msSql and python
That was it exactly - I didn't have the right python syntax but had thought the mistake was in the zsql. Thanks! Kate -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Floyd May Sent: Thursday, November 10, 2005 12:04 PM To: Zope Subject: Re: [Zope] msSql and python You can pass arguments to ZSQL Methods. In this particular case, I assume that you don't want the WHERE clause in the query if the 'description' parameter is not passed? You can do it like this (inside the query): --8 dtml-if description WHERE description = dtml-sqlvar description type=string /dtml-if --8 Then, inside your python script: --8 desc = 'some string' context.path.to.query.queryname(description=desc) --8 Hope that helps! fm On 11/10/05, Kate Legere [EMAIL PROTECTED] wrote: I have a zsql method to which I want to pass and argument. Normally I do it from a dtml method and the use something like this to test for equality. WHERE description = dtml-sqlvar description type=string. However, I'm passing the variable from a python script and it won't accept the dtml tag what do I put in the equality test? Kate ___ 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 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 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] AttributeError in DocFinder 1.0.3
I've installed DocFinder 1.0.3 but I'm getting an error when I try to instantiate. I'm running (Zope 2.6.2 (binary release, python 2.1, linux2-x86), python 2.1.3, linux2) Python Version 2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] I also found standard_template.pt on my local installation and copied it to the same directory on the server but that doesn't help either. What do I need to add? Kate Exception Type AttributeError Exception Value standard_template.pt Traceback (innermost last): * Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module Shared.DC.Scripts.Bindings, line 252, in __call__ * Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec * Module Products.PageTemplates.PageTemplateFile, line 96, in _exec * Module Products.PageTemplates.PageTemplate, line 95, in pt_render PageTemplateFile at / * Module TAL.TALInterpreter, line 200, in __call__ * Module TAL.TALInterpreter, line 244, in interpret * Module TAL.TALInterpreter, line 689, in do_useMacro * Module Products.PageTemplates.TALES, line 220, in evaluate URL: addForm Line 1, Column 0 Expression: standard:'here/standard_template.pt/macros/page' Names: {'container': __FactoryDispatcher__ instance at 8f47fb8, 'default': Products.PageTemplates.TALES.Default instance at 0x867d0f4, 'here': __FactoryDispatcher__ instance at 8f47fb8, 'loop': SafeMapping instance at 8e453e0, 'modules': Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x867cdec, 'nothing': None, 'options': {'args': ()}, 'repeat': SafeMapping instance at 8e453e0, 'request': HTTPRequest, URL=http://www2.kfpl.ca:8080/manage_addProduct/DocFinder/addForm, 'root': Application instance at 8df00f0, 'template': PageTemplateFile at /, 'traverse_subpath': [], 'user': zope} * Module Products.PageTemplates.Expressions, line 206, in __call__ * Module Products.PageTemplates.Expressions, line 194, in _eval * Module Products.PageTemplates.Expressions, line 150, in _eval __traceback_info__: here * Module Products.PageTemplates.Expressions, line 360, in restrictedTraverse __traceback_info__: {'path': ['standard_template.pt', 'macros', 'page'], 'TraversalRequestNameStack': ['page', 'macros']} AttributeError: standard_template.pt ___ 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] python question
I may be asking this in the wrong place but I have a tal page where I want to use python to display only the most recent addition to a folder of files. I can sort the folder and return all the files easily with: return sequence.sort(files, (('bobobase_modification_time', 'cmp', 'desc'),)) How do I return just the most recent one? (I tried sorting and then using return max(files) but that doesn't give me all the properties and I need them for display) Kate ___ 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] python question
Thanks - turns out the real error was in the file dealing with it - all fixed now. Thanks for the help. Kate -Original Message- From: Jim Abramson [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 31, 2005 2:38 PM To: Kate Legere; Zope Subject: RE: [Zope] python question sort() on a sequence does not return anything. It operates on the [mutable] sequence in place. You probably want to push this bit into a python script where you have more elbow room, and do this: files.sort(etc,etc) return files[0] hth, Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kate Legere Sent: Tuesday, May 31, 2005 3:35 PM To: Zope Subject: [Zope] python question I may be asking this in the wrong place but I have a tal page where I want to use python to display only the most recent addition to a folder of files. I can sort the folder and return all the files easily with: return sequence.sort(files, (('bobobase_modification_time', 'cmp', 'desc'),)) How do I return just the most recent one? (I tried sorting and then using return max(files) but that doesn't give me all the properties and I need them for display) Kate ___ 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 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 )