[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py Added test for strftime with unicode pattern.
Log message for revision 30570: Added test for strftime with unicode pattern. Changed: U Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py === --- Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 2005-05-31 14:30:17 UTC (rev 30569) +++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/testDateTime.py 2005-05-31 14:58:17 UTC (rev 30570) @@ -373,7 +373,10 @@ dt2 = DateTime('2040/01/30 11:33 GMT-2') self.assertEqual(dt1.strftime('%d/%m/%Y %H:%M'), dt2.strftime('%d/%m/%Y %H:%M')) - +def testStrftimeUnicode(self): +dt = DateTime('2002-05-02T08:00:00+00:00') +self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), + u'Le 02/05/2002 \xe0 10h00') def test_suite(): return unittest.makeSuite(DateTimeTests) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/tests/testDateTime.py Merged revision 30570 from Zope-2_8-branch:
Log message for revision 30571: Merged revision 30570 from Zope-2_8-branch: Added test for strftime with unicode pattern. Changed: U Zope/trunk/lib/python/DateTime/tests/testDateTime.py -=- Modified: Zope/trunk/lib/python/DateTime/tests/testDateTime.py === --- Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-05-31 14:58:17 UTC (rev 30570) +++ Zope/trunk/lib/python/DateTime/tests/testDateTime.py2005-05-31 16:00:54 UTC (rev 30571) @@ -373,7 +373,10 @@ dt2 = DateTime('2040/01/30 11:33 GMT-2') self.assertEqual(dt1.strftime('%d/%m/%Y %H:%M'), dt2.strftime('%d/%m/%Y %H:%M')) - +def testStrftimeUnicode(self): +dt = DateTime('2002-05-02T08:00:00+00:00') +self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), + u'Le 02/05/2002 \xe0 10h00') def test_suite(): return unittest.makeSuite(DateTimeTests) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/zdctl.py Collector # 1323: applied patch to fix umask handling in zdctl
Log message for revision 30572: Collector # 1323: applied patch to fix umask handling in zdctl Changed: U zdaemon/trunk/zdctl.py -=- Modified: zdaemon/trunk/zdctl.py === --- zdaemon/trunk/zdctl.py 2005-05-31 16:00:54 UTC (rev 30571) +++ zdaemon/trunk/zdctl.py 2005-05-31 16:14:00 UTC (rev 30572) @@ -213,7 +213,7 @@ args += self._get_override(-f, forever, flag=1) args += self._get_override(-s, sockname) args += self._get_override(-u, user) -args += self._get_override(-m, umask) +args += self._get_override(-m, umask, oct(self.options.umask)) args += self._get_override( -x, exitcodes, ,.join(map(str, self.options.exitcodes))) args += self._get_override(-z, directory) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/tags/zdaemon-Zope-2-8-0/ version for final Zope 2.8.0 release
Log message for revision 30573: version for final Zope 2.8.0 release Changed: A zdaemon/tags/zdaemon-Zope-2-8-0/ -=- Copied: zdaemon/tags/zdaemon-Zope-2-8-0 (from rev 30572, zdaemon/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/zdaemon/ replacing local copy with external definition
Log message for revision 30574: replacing local copy with external definition Changed: D Zope/trunk/lib/python/zdaemon/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-dev] Re: [Zope-Checkins] CVS: Products/PluginIndexes/common - UnIndex.py:1.20.2.7
Tres Seaver wrote: +if set is None: +set = IISet(()) +elif type(set) is IntType: # isinstance(set, int) for 2.8 How come isinstance is only to be used for 2.8? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: [Zope-Checkins] CVS: Products/PluginIndexes/common- UnIndex.py:1.20.2.7
Chris Withers wrote: Tres Seaver wrote: +if set is None: +set = IISet(()) +elif type(set) is IntType: # isinstance(set, int) for 2.8 How come isinstance is only to be used for 2.8? Hi, when I wrote the patch and the test case I tried to be consistent with the actual code. On 2.7 the check was done with type() while on 2.8 with isinstance(), so I added a comment. Probably I should have stated this in the collector entry. Regards -- (@ @) oOO(_)OOo-- Ojo por ojo y el mundo acabara ciego /\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain) --- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: mechanism for license boilerplate?
On May 30, 2005, at 20:39, Chad Whitacre wrote: Thanks, that's what I figured. ;-) IIRC the last time I did something like that (moving CMF to ZPL 2.1) I wrote a python script to replace the text appropriately... sed and awk are also good tools for that when you're good at shell scripting. jens ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] mechanism for license boilerplate?
On May 30, 2005, at 3:06 PM, Andreas Jung wrote: --On 30. Mai 2005 12:35:22 -0400 Chad Whitacre [EMAIL PROTECTED] wrote: Dear all, I am wondering what mechanism the Zope team uses to manage the copyright/license boilerplate at the top of every file. Is this handled manually or is it automated? Cut Paste :-) If you include Zope 3, Zope 3 has utilities/headerfix.py. Haven't used it in a long time, if ever, but it might be worth a look if you want something automated. Gary ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: CMFSetup + ZopeTestCase interaction bug
On 5/25/05, Lennart Regebro [EMAIL PROTECTED] wrote: When you use the installProduct command of ZopeTestCase on a product that has a CMFSetup profile you may get the following error: File /home/zopes/27test/Products/CMFSetup/registry.py, line 567, in registerProfile raise KeyError, 'Duplicate profile ID: %s' % profile_id KeyError: 'Duplicate profile ID: profile id' This typically happens on the profile CMFDefault:default. This also *only* happens if you try to run all tests in Products. The reason seem to be that all or some of the products gets installed by Zope. When you then try to install them again with installProduct, you get the error. My suggested solution is to merge ZopeTestCases list of installed products with Zopes list of installed products, as these for the moment are not the same, as far as I can see. I discussed this with Stefan Holek yesterday, and today I tried this solution, and it seems to work fine. This error happens both with Zope2.7 and 2.8. But...I suggest that I only change this in Zope 2.8 anyway, to make sure we don't break anything that relies on this ZopeTestCase behaviour. Unless somebody screams, I will include this bugfix in 2.8 today or tomorrow. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope-Checkins] SVN: Zope/trunk/ - Collector #1323: applied patch to fix umask problem in zdctl
[Andreas Jung] Log message for revision 30558: - Collector #1323: applied patch to fix umask problem in zdctl Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/zdaemon/zdctl.py Andreas, Zope doesn't own zdaemon. zdaemon is (so far) *copied* into Zope from repos/main/zdaemon/trunk/. Checkins made to a zdaemon copy from a client project (like Zope) have no effect on the zdaemon code. So, for example, the zdaemon trunk is still broken, the zdaemon copies in Zope3 and in ZODB are still broken, and the changes you checked in to Zope's copy are likely to get lost the next time someone copies zdaemon into Zope. The right way to fix this in Zope is: 1. Apply the patch to repos/main/zdaemon/trunk/. 2. Make a tag of zdaemon trunk. 3. Delete (svn rm) Zope's copy of zdaemon and commit. 4. From a Zope checkout, svn propedit svn:externals lib/python, and add a line naming the zdaemon tag you created in step #2. That would make zdaemon like Zope's other external code (the ZopeX3 stuff, assorted ZODB directories, and ZConfig), and the existence of a zdaemon tag (there isn't one now) would make it easy for other projects (like Zope3 and ZODB) to use the _same_ zdaemon code. ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope-Checkins] SVN: Zope/trunk/ - Collector #1323: applied patch to fix umask problem in zdctl
[Andreas Jung] I thought Fred hooked zdaemon and ZConfig already as external definition. But apparently this happened only for ZConfig. That's correct; nothing about zdaemon has changed yet. Back on 13 May: [me] The first time ZConfig and zdaemon get tagged, it's important that whoever do that first search all clients (ZODB and both Zopes) for changes to those checked in from a wrong project, and do merges back to ZConfig and zdaemon (I explained that dance last time) -- else those changes (if any) will get lost. [you] That's a job for loosers :-) but I will take it over for ZConfig and ZDaemon.. maybe not for the next beta but hopefully for the final for 2.8.1 release. so I thought you would be doing this. Fred fixed a bug in ZConfig since then, and did the right thing to get it fixed everywhere. The same hasn't been done for zdaemon yet, and I'm sure Fred won't be doing it. If it *had* been done already, SVN would not have allowed you to check in a change to zdaemon made from Zope, forcing you to make the change in the right place (i.e., in zdaemon) instead. ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope] Uninstall a zope built from source
Hello, Some time ago, I built zope from the sources and it worked well. Now I prefer the way Debian easily offers instances and an init.d script. I would like to uninstall the Zope from the source bt I can't find a target for make to do an uninstall. I have a googled for a while without success. I have few folders named zope in the /usr/local, /var/lib and i am not always sure they belongs to the source install or the debian version. * Does anyone knows about a uninstall script? * If I have to do it by hand, where can I find docs that tells what to remove? (the install python script is long) How to be sure everything is gone? Have a good day, ___ 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] Uninstall a zope built from source
--On 31. Mai 2005 11:27:47 +0200 Rob Wilco [EMAIL PROTECTED] wrote: Hello, Some time ago, I built zope from the sources and it worked well. Now I prefer the way Debian easily offers instances and an init.d script. I would like to uninstall the Zope from the source bt I can't find a target for make to do an uninstall. Zope has no uninstall target. rm -fr ZOPE_INSTALLATION_HOME ZOPE_INSTANCE_HOME should do the job. -aj pgpU4NLTDp5J7.pgp Description: PGP signature ___ 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] Uninstall a zope built from source
Am Dienstag, den 31.05.2005, 11:27 +0200 schrieb Rob Wilco: Hello, Some time ago, I built zope from the sources and it worked well. Now I prefer the way Debian easily offers instances and an init.d script. recent zope versions have that as well (e.g = 2.7) I would like to uninstall the Zope from the source bt I can't find a target for make to do an uninstall. yes, there is none. I have a googled for a while without success. I have few folders named zope in the /usr/local, /var/lib and i am not always sure they belongs to the source install or the debian version. * Does anyone knows about a uninstall script? * If I have to do it by hand, where can I find docs that tells what to remove? (the install python script is long) How to be sure everything is gone? Which version did you install from source? Are you using the debian version yet? If not, just apt-get remove --purge zope first to get rid of all debian traces and then remove the zope where you installed it. (Should really be just one directory for the zope and one per instance depending how you installed it.) -- Tino Wildenhain [EMAIL PROTECTED] ___ 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] Creating links dynamically
I want to provide a set of links on a Zope site dynamically. ie don't want to hard code a number of links, but would like to load them from an external source which I can add to independently, but I have no idea as to how to set about it. Any ideas? I'd be quite happy to have the links in a text file with one link per line. -- John ___ 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] Creating links dynamically
John Poltorak wrote: I want to provide a set of links on a Zope site dynamically. ie don't want to hard code a number of links, but would like to load them from an external source which I can add to independently, but I have no idea as to how to set about it. Any ideas? I'd be quite happy to have the links in a text file with one link per line. 1) Create a script that returns a list of links: ## Script (Python) linkList return [ 'link1', ... 'linkN' ] 2) Use this script on your page. For example, tal:block repeat=link here/linkList span tal:replace=structure link / /tal:block ___ 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] Creating links dynamically
On Tue, May 31, 2005 at 06:23:11PM +0300, Vital Lobachevsky wrote: John Poltorak wrote: I want to provide a set of links on a Zope site dynamically. ie don't want to hard code a number of links, but would like to load them from an external source which I can add to independently, but I have no idea as to how to set about it. Any ideas? I'd be quite happy to have the links in a text file with one link per line. 1) Create a script that returns a list of links: ## Script (Python) linkList return [ 'link1', ... 'linkN' ] 2) Use this script on your page. For example, tal:block repeat=link here/linkList span tal:replace=structure link / /tal:block Many thanks for your suggestion. Is there a worked example of doing this anywhere? There seem to be quite a few steps involved in trying to get this working and I'm no expert in writing python scripts, and it will probably take me a couple of days to get this working. -- John ___ 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] Creating links dynamically
John Poltorak wrote: On Tue, May 31, 2005 at 06:23:11PM +0300, Vital Lobachevsky wrote: John Poltorak wrote: I want to provide a set of links on a Zope site dynamically. ie don't want to hard code a number of links, but would like to load them from an external source which I can add to independently, but I have no idea as to how to set about it. Any ideas? I'd be quite happy to have the links in a text file with one link per line. 1) Create a script that returns a list of links: ## Script (Python) linkList return [ 'link1', ... 'linkN' ] 2) Use this script on your page. For example, tal:block repeat=link here/linkList span tal:replace=structure link / /tal:block Many thanks for your suggestion. Is there a worked example of doing this anywhere? There seem to be quite a few steps involved in trying to get this working and I'm no expert in writing python scripts, and it will probably take me a couple of days to get this working. Well, it's really easy. Create 'linkList' (Python Script) in the folder where you page lives or somewhere higher in folder hierarchy: ## Script (Python) linkList return [ ('http://www.google.com/', 'Google'), ('http://www.yahoo.com/', 'Yahoo'), ] If your page is Page Template, it maybe something like this html body h1Search Engines/h1 tal:block repeat=item here/linkList a tal:content=python:item[1] tal:attributes=href python:item[0]/abr / /tal:block /body /html If you page is DTML Method, you can do the same using dtml-in tag. ___ 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] Creating links dynamically
John Poltorak wrote at 2005-5-31 16:39 +0100: ... Many thanks for your suggestion. Is there a worked example of doing this anywhere? The CMF's ActionsTool is a prime example for such a link factory. CMFDefaults main_template.pt demonstrates how to iterate over the links generated by portal_actions (the ActionsTool instance in a CMF site). -- 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 )
Re: [Zope] Re: PIL: can't call same method twice
KLEIN Stéphane wrote at 2005-5-31 00:13 +0200: ... I've the same problem and now it's work with this tip : context.REQUEST.image.seek(0). My xImageScale.py [external method] is : def xImageScale(img_file, maxx, maxy): from PIL import Image from cStringIO import StringIO img_file.seek(0) im = Image.open(img_file) im.thumbnail((maxx, maxy), Image.ANTIALIAS) out_file_str = StringIO() im.save(out_file_str, im.format) out_file_str.seek(0) tmp=out_file_str.read() out_file_str.close() return tmp You need to learn that you *MUST* provide a *FULL* problem description when you seek help. This includes Error Type, Error Value and Traceback in case you get an exception, and otherwise a clear description what went wrong. -- 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 )
RE: [Zope] zope vs. memory [was Re: Refcounts, ZODB Cache and memory leaks?]
Andy Yates wrote at 2005-5-30 22:52 -0500: ... When you fixed the TempStorage the leak indeed slowed down significantly. However, Zope still leaks memory. If left uncheck Zope will still consume all available memory and crash the server. We have resigned ourselves to restarting Zope every few weeks. Looks acceptable, doesn't it? Such leaks can be caused by so called memory fragmentation. Memory fragmentation describes the situation where the available free memory is spread over large amounts of small blocks. When you need a somewhat larger block, then a new large block is requested from the OS and cut down into smaller pieces. Thus, this block, too, may finally end up as a set of small blocks. Memory fragmentation is something like the entropy increase in the world... Restarting gives you a new world with small entropy... -- 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] 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
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 )
Re: [Zope] python question
Kate Legere wrote: 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) If it's sorted, you can use a Python slice:: return sequence.sort(files, (('bobobase_modification_time', 'cmp', 'desc'),))[0] The trick is the last three characters. See http://docs.python.org/tut/node5.html --jcc -- Building Websites with Plone http://plonebook.packtpub.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] Creating links dynamically
John Poltorak wrote: On Tue, May 31, 2005 at 07:17:46PM +0300, Vital Lobachevsky wrote: John Poltorak wrote: On Tue, May 31, 2005 at 06:23:11PM +0300, Vital Lobachevsky wrote: Many thanks for your suggestion. Is there a worked example of doing this anywhere? There seem to be quite a few steps involved in trying to get this working and I'm no expert in writing python scripts, and it will probably take me a couple of days to get this working. Well, it's really easy. Create 'linkList' (Python Script) in the folder where you page lives or somewhere higher in folder hierarchy: ## Script (Python) linkList return [ ('http://www.google.com/', 'Google'), ('http://www.yahoo.com/', 'Yahoo'), ] If your page is Page Template, it maybe something like this html body h1Search Engines/h1 tal:block repeat=item here/linkList a tal:content=python:item[1] tal:attributes=href python:item[0]/abr / /tal:block /body /html If you page is DTML Method, you can do the same using dtml-in tag. Thanks for the suggestion, but I really am a novice when it comes to all this and you are probably presuming more expertise than I have. I created a Page Template exactly as you suggested. It's called test and is in the testsite folder - the contents are pasted from your example. The python script was pasted into a file object called linkList which has a Content Type of text/x-unknown-content-type. Why did you put it in a File? Why not a Script (Python)? --jcc -- Building Websites with Plone http://plonebook.packtpub.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] 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 )
Re: [Zope] Creating links dynamically
On Tue, May 31, 2005 at 08:54:30PM +0200, Dieter Maurer wrote: John Poltorak wrote at 2005-5-31 16:39 +0100: ... Many thanks for your suggestion. Is there a worked example of doing this anywhere? The CMF's ActionsTool is a prime example for such a link factory. CMFDefaults main_template.pt demonstrates how to iterate over the links generated by portal_actions (the ActionsTool instance in a CMF site). Does that mean creating a CMF site? I'm finding it hard enough figuring stuff out without adding CMF into the mix... -- Dieter -- John ___ 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] Creating links dynamically
On Tue, May 31, 2005 at 02:51:18PM -0500, J Cameron Cooper wrote: John Poltorak wrote: Well, it's really easy. Create 'linkList' (Python Script) in the folder where you page lives or somewhere higher in folder hierarchy: ## Script (Python) linkList return [ ('http://www.google.com/', 'Google'), ('http://www.yahoo.com/', 'Yahoo'), ] If you page is DTML Method, you can do the same using dtml-in tag. Thanks for the suggestion, but I really am a novice when it comes to all this and you are probably presuming more expertise than I have. I created a Page Template exactly as you suggested. It's called test and is in the testsite folder - the contents are pasted from your example. The python script was pasted into a file object called linkList which has a Content Type of text/x-unknown-content-type. Why did you put it in a File? Why not a Script (Python)? I'm using a remote site and only have access via Zope's ZMI. Can I create a script through that? --jcc -- Building Websites with Plone http://plonebook.packtpub.com/ -- John ___ 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
Am Dienstag, den 31.05.2005, 15:34 -0400 schrieb Kate Legere: 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) Use: return sequence.sort(files, (('bobobase_modification_time', 'cmp','desc'),))[:3] [:3] is a slice operator which returns item0...item2 since you sorted descenting by modification time, the first 3 objects should be the most recent 3. Regards Tino ___ 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
Am Dienstag, den 31.05.2005, 15:38 -0400 schrieb Jim Abramson: sort() on a sequence does not return anything. It operates on the [mutable] sequence in place. sequence is a module in Zope. So she indeed was right. ___ 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
blast! i'll keep my mouth shut til I get the library memorized. Jim -Original Message- From: Tino Wildenhain [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 31, 2005 4:06 PM To: Jim Abramson Cc: Kate Legere; Zope Subject: RE: [Zope] python question Am Dienstag, den 31.05.2005, 15:38 -0400 schrieb Jim Abramson: sort() on a sequence does not return anything. It operates on the [mutable] sequence in place. sequence is a module in Zope. So she indeed was right. ___ 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] Creating links dynamically
John Poltorak wrote: On Tue, May 31, 2005 at 02:51:18PM -0500, J Cameron Cooper wrote: John Poltorak wrote: Well, it's really easy. Create 'linkList' (Python Script) in the folder where you page lives or somewhere higher in folder hierarchy: ## Script (Python) linkList return [ ('http://www.google.com/', 'Google'), ('http://www.yahoo.com/', 'Yahoo'), ] If you page is DTML Method, you can do the same using dtml-in tag. Thanks for the suggestion, but I really am a novice when it comes to all this and you are probably presuming more expertise than I have. I created a Page Template exactly as you suggested. It's called test and is in the testsite folder - the contents are pasted from your example. The python script was pasted into a file object called linkList which has a Content Type of text/x-unknown-content-type. Why did you put it in a File? Why not a Script (Python)? I'm using a remote site and only have access via Zope's ZMI. Can I create a script through that? Certainly. It's in the dropdown. In fact, that's why I used the silly canonical name Script (Python) rather than Python script. --jcc -- Building Websites with Plone http://plonebook.packtpub.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] Creating links dynamically
On Tue, May 31, 2005 at 03:08:36PM -0500, J Cameron Cooper wrote: John Poltorak wrote: Why did you put it in a File? Why not a Script (Python)? I'm using a remote site and only have access via Zope's ZMI. Can I create a script through that? Certainly. It's in the dropdown. In fact, that's why I used the silly canonical name Script (Python) rather than Python script. A... I see now Thanks for pointing that out. There are just so many options which appear from that drop down menu and I've only got used to a few of them so far. Looks like I've learned something really worthwhile today! --jcc -- Building Websites with Plone http://plonebook.packtpub.com/ -- John ___ 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] Creating links dynamically
On 31.Mai 2005 - 20:47:20, John Poltorak wrote: Thanks for the suggestion, but I really am a novice when it comes to all this and you are probably presuming more expertise than I have. Just a suggestion: Start reading the Zope Book (the latest version is on http://www.plope.com/Books/2_7Edition), it really getting to know Zope. Andreas -- Cold hands, no gloves. ___ 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 )