[Zope-dev] Zope2 OFS/CopySupport's _get_id()
Hello, While I was reading the _get_id function, I felt it was really strange : def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1 currently, when copying and pasting an object, 'copy[0-9]*_of_' will be prepended to the id (if the id is already in use in the current folder). Thus, copying 'x' will create 'copy_of_x', 'copy2_of_x', etc. and copying 'copy_of_x' will create 'copy_of_copy_of_x', 'copy2_of_copy_of_x', etc. What I don't get, is what the two lines between 'n=0' and 'orig_id=id' are supposed to do. What they do is this : if an object id is 16 chars long, and it ends with 'copy_of_' (like 'copy_of_'), its first copy will be called 'copy2_of_copy_of_' instead of 'copy_of_copy_of_'... What I think the author intended to do, is that, when you copy an object called 'copy_of_x', the copy will be named 'copy2_of_x' instead of 'copy_of_copy_of_x'. Thus, here's a function that does the job : import re copy_re=re.compile('^copy[0-9]*_of_') def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. copy_match=self.copy_re.match(id) if (copy_match) and (copy_match.end() len(id)): n=1 orig_id=self.copy_re.sub('', id) else: n=0 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1 Then, I don't know what is the preferred naming for new objects, but I fear that 'copy_of_copy_of_copy_of_copy_of_copy_of_copy_of_object' will quickly be too long, if objects are copied by an automated process that doesn't show the Ids to the user or don't allow their modification. What are your feelings about this ? Regards, Alexandre Boeglin ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] Zope on 64-bit Linux
Hi Larry, We are using Zope/ZEO 2.7.x on a small cluster of AMD Opteron machines to host an online learning environment for our medical students (around 1100 in all), providing on-the-fly timetables, study and lecture notes, module booking, downloadable resources, discussion forums, etc.. Machines are Sun V20z dual 248 Opterons, each with 4Gb of RAM, dual gigabit ethernet and 10krpm scsi disks. This is all hosted on a private gigabit network, with a local LDAP authentication server. Access to the sites is via a load-balancing gateway running 'Pound'. The Opteron nodes (3 of the above spec, at the moment) are running SuSE 9.1/Pro/X86_64, with the SuSE provided python64 binaries and libs. All the extensions and py modules we use are compiled against /lib64. The Opteron nodes host the sites, using Zope 2.7.2, connecting to a bigger, but slower Sun fileserver, which serves the data fs via ZEO. Performance is blistering; but we could easily improve it with squid. We've benchmarked the Opterons against dual Xeon systems (2.8, 3.0) and they are *way* faster. If you want any more details, just let me know... Anyone out there successfully deploying and running Zope/CMF on 64-bit Linux? I'm looking at deploying AMD Opteron server for hosting large Zope site and wanted to take advantage of the speed and addressing capabilities if I could. Specifically I'd like to use RedHat Fedora Core 3 to run ZODB server and ZEO Clients. Any information would be greatly appreciated. Thanks in advance, Larry Bates John Snowdon - IT Support Specialist -==- School of Medical Education Development Faculty of Medical Sciences Computing University of Newcastle Phone : 0191 246 4549 Email : [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] Zope2 OFS/CopySupport's _get_id()
+1 The copy_of_copy_of... stuff has always bugged me but I confess I never really looked at the code. I don't foresee any compatibility problems (any code that relies on the fact that a copy of 'copy_of_x' is named 'copy_of_copy_of_x' surely deserves to die). Please post this in the Zope collector so that it doesn't get lost. Florent In article [EMAIL PROTECTED] you write: Hello, While I was reading the _get_id function, I felt it was really strange : def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1 currently, when copying and pasting an object, 'copy[0-9]*_of_' will be prepended to the id (if the id is already in use in the current folder). Thus, copying 'x' will create 'copy_of_x', 'copy2_of_x', etc. and copying 'copy_of_x' will create 'copy_of_copy_of_x', 'copy2_of_copy_of_x', etc. What I don't get, is what the two lines between 'n=0' and 'orig_id=id' are supposed to do. What they do is this : if an object id is 16 chars long, and it ends with 'copy_of_' (like 'copy_of_'), its first copy will be called 'copy2_of_copy_of_' instead of 'copy_of_copy_of_'... What I think the author intended to do, is that, when you copy an object called 'copy_of_x', the copy will be named 'copy2_of_x' instead of 'copy_of_copy_of_x'. Thus, here's a function that does the job : import re copy_re=re.compile('^copy[0-9]*_of_') def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. copy_match=self.copy_re.match(id) if (copy_match) and (copy_match.end() len(id)): n=1 orig_id=self.copy_re.sub('', id) else: n=0 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1 Then, I don't know what is the preferred naming for new objects, but I fear that 'copy_of_copy_of_copy_of_copy_of_copy_of_copy_of_object' will quickly be too long, if objects are copied by an automated process that doesn't show the Ids to the user or don't allow their modification. What are your feelings about this ? Regards, Alexandre Boeglin ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 ) -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] CVS: Zope - test.py:1.2.2.16
Sorry Florent, I missed your warning mail. I have two issues with the patch: a) Trailing slash no longer works (--libdir Products/) b) Some combinations of --libdir and --dir and symlinks no longer work on Mac OS X (HFS) Unfortunately os.getcwd() returns different paths in the presence of symlinks on Mac and Linux (already realpath'd vs not). I don't have a good solution for this either. You have a Mac haven't you? Does it work for you across all platforms? Thanks, Stefan On 19. Nov 2004, at 14:49, Florent Guillaume wrote: Update of /cvs-repository/Zope In directory cvs.zope.org:/tmp/cvs-serv20719 Modified Files: Tag: Zope-2_7-branch test.py Log Message: Fixed to work in the presence of symliked products or Products directory. === Zope/test.py 1.2.2.15 = 1.2.2.16 === --- Zope/test.py:1.2.2.15 Sat Oct 30 04:29:22 2004 +++ Zope/test.py Fri Nov 19 08:48:59 2004 @@ -380,11 +380,12 @@ self.cwd = os.path.realpath(os.getcwd()) # Hack again for external products. if libdir: -self.libdir = os.path.realpath(os.path.join(self.cwd, libdir)) +self.libdir = os.path.join(self.cwd, libdir) else: -self.libdir = os.path.realpath(os.path.join(self.cwd, self.libdir)) -if self.libdir not in sys.path: -sys.path.insert(0, self.libdir) +self.libdir = os.path.join(self.cwd, self.libdir) +real_libdir = os.path.realpath(self.libdir) +if real_libdir not in sys.path: +sys.path.insert(0, real_libdir) # Determine where to look for tests if test_dir: self.testdir = os.path.abspath(os.path.join(self.cwd, test_dir)) ___ Zope-Checkins maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-checkins -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/ ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] CVS: Zope - test.py:1.2.2.16
Stefan H. Holek wrote: Sorry Florent, I missed your warning mail. I have two issues with the patch: a) Trailing slash no longer works (--libdir Products/) This is probably fixable by an explicit test. b) Some combinations of --libdir and --dir and symlinks no longer work on Mac OS X (HFS) Could you give detail so I can reproduce it ? Unfortunately os.getcwd() returns different paths in the presence of symlinks on Mac and Linux (already realpath'd vs not). I don't have a good solution for this either. You have a Mac haven't you? Does it work for you across all platforms? The tests I did worked, but I may not have fully tested the symlinks problems (I had them and fixed them on Linux). My Mac is at home, I'll test tonight. Florent Thanks, Stefan On 19. Nov 2004, at 14:49, Florent Guillaume wrote: Update of /cvs-repository/Zope In directory cvs.zope.org:/tmp/cvs-serv20719 Modified Files: Tag: Zope-2_7-branch test.py Log Message: Fixed to work in the presence of symliked products or Products directory. === Zope/test.py 1.2.2.15 = 1.2.2.16 === --- Zope/test.py:1.2.2.15Sat Oct 30 04:29:22 2004 +++ Zope/test.pyFri Nov 19 08:48:59 2004 @@ -380,11 +380,12 @@ self.cwd = os.path.realpath(os.getcwd()) # Hack again for external products. if libdir: -self.libdir = os.path.realpath(os.path.join(self.cwd, libdir)) +self.libdir = os.path.join(self.cwd, libdir) else: -self.libdir = os.path.realpath(os.path.join(self.cwd, self.libdir)) -if self.libdir not in sys.path: -sys.path.insert(0, self.libdir) +self.libdir = os.path.join(self.cwd, self.libdir) +real_libdir = os.path.realpath(self.libdir) +if real_libdir not in sys.path: +sys.path.insert(0, real_libdir) # Determine where to look for tests if test_dir: self.testdir = os.path.abspath(os.path.join(self.cwd, test_dir)) ___ Zope-Checkins maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-checkins -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/ -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] 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] CVS: Zope - test.py:1.2.2.16
This one does not even need symlinks (note that I run the tests from Products): localhost:/Users/zope/plone27/Products$ \ /Zope/bin/test.py -v -C ../etc/zope.conf --libdir . --dir CMFPlone Running unit tests at level 1 Running unit tests from /Users/zope/plone27/Products/CMFPlone Parsing /Users/zope/plone27/etc/zope.conf -- Ran 0 tests in 0.000s OK I think you may at least want to abspath the libdir. Also, it seems that TestFileFinder uses libdir whereas you add real_libdir to the sys.path... Stefan On 22. Nov 2004, at 18:32, Florent Guillaume wrote: b) Some combinations of --libdir and --dir and symlinks no longer work on Mac OS X (HFS) Could you give detail so I can reproduce it ? -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/ ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )