[Zope-Checkins] SVN: zdaemon/branches/jim-env/ retire old dev branch
Log message for revision 77463: retire old dev branch Changed: D zdaemon/branches/jim-env/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/branches/tseaver-eggification/ retire old dev branch
Log message for revision 77462: retire old dev branch Changed: D zdaemon/branches/tseaver-eggification/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/zd Moved set_uid out to the ctl script.
Log message for revision 71933: Moved set_uid out to the ctl script. Changed: U zdaemon/trunk/src/zdaemon/zdctl.py U zdaemon/trunk/src/zdaemon/zdrun.py -=- Modified: zdaemon/trunk/src/zdaemon/zdctl.py === --- zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-11 20:04:04 UTC (rev 71932) +++ zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-11 20:40:54 UTC (rev 71933) @@ -141,6 +141,17 @@ for k, v in options.configroot.environment.mapping.items(): os.environ[k] = v +self.set_uid() + +def set_uid(self): +if self.options.uid is None: +return +uid = os.geteuid() +if uid != 0 and uid != self.options.uid: +self.options.usage(only root can use -u USER to change users) +os.setgid(self.options.gid) +os.setuid(self.options.uid) + def emptyline(self): # We don't want a blank line to repeat the last command. # Showing status is a nice alternative. Modified: zdaemon/trunk/src/zdaemon/zdrun.py === --- zdaemon/trunk/src/zdaemon/zdrun.py 2007-01-11 20:04:04 UTC (rev 71932) +++ zdaemon/trunk/src/zdaemon/zdrun.py 2007-01-11 20:40:54 UTC (rev 71933) @@ -248,18 +248,8 @@ self.options = ZDRunOptions() self.options.realize(args) self.logger = self.options.logger -self.set_uid() self.run() -def set_uid(self): -if self.options.uid is None: -return -uid = os.geteuid() -if uid != 0 and uid != self.options.uid: -self.options.usage(only root can use -u USER to change users) -os.setgid(self.options.gid) -os.setuid(self.options.uid) - def run(self): self.proc = Subprocess(self.options) self.opensocket() ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/ Updated release info
Log message for revision 71934: Updated release info Changed: U zdaemon/trunk/CHANGES.txt U zdaemon/trunk/setup.py -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2007-01-11 20:40:54 UTC (rev 71933) +++ zdaemon/trunk/CHANGES.txt 2007-01-11 20:43:33 UTC (rev 71934) @@ -1,21 +1,23 @@ zdaemon Changelog * -zdaemon 2.0a4, 2.0a5 (2007/01/10) -= +zdaemon 2.0a6 (2007/01/11) +== Bugs Fixed -- -- The new (2.0) mechanism used by zdaemon to start the daemon manager - broke some applications that extended zdaemon. +- When the user option was used, it only affected running the daemon. -zdaemon 2.0a3 (2007/01/10) -== +zdaemon 2.0a3, 2.0a4, 2.0a5 (2007/01/10) + Bugs Fixed -- +- The new (2.0) mechanism used by zdaemon to start the daemon manager + broke some applications that extended zdaemon. + - Added extra checks to deal with programs that extend zdaemon and copy the schema and thus don't see updates to the ZConfig schema. Modified: zdaemon/trunk/setup.py === --- zdaemon/trunk/setup.py 2007-01-11 20:40:54 UTC (rev 71933) +++ zdaemon/trunk/setup.py 2007-01-11 20:43:33 UTC (rev 71934) @@ -37,7 +37,7 @@ name = zdaemon setup( name=name, -version=2.0a5, +version=2.0a6, url=http://www.python.org/pypi/zdaemon;, license=ZPL 2.1, description= ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/ Updated release info:
Log message for revision 71854: Updated release info: New Features: - Added support for setting environment variables in the configuration file. This is useful when zdaemon is used to run programs that need environment variables set (e.g. LD_LIBRARY_PATH). - Added a command to rotate the transcript log. Changed: U zdaemon/trunk/CHANGES.txt U zdaemon/trunk/README.txt U zdaemon/trunk/setup.py U zdaemon/trunk/src/zdaemon/README.txt U zdaemon/trunk/src/zdaemon/component.xml U zdaemon/trunk/src/zdaemon/schema.xml U zdaemon/trunk/src/zdaemon/tests/tests.py U zdaemon/trunk/src/zdaemon/zdctl.py U zdaemon/trunk/src/zdaemon/zdrun.py -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2007-01-10 10:16:55 UTC (rev 71853) +++ zdaemon/trunk/CHANGES.txt 2007-01-10 11:36:01 UTC (rev 71854) @@ -1,28 +1,18 @@ zdaemon Changelog * -To-Dos -== +zdaemon 2.0a2 (2007/01/08) +== -More docs: +New Features + -- Document/demonstrate some important features, such as: +- Added support for setting environment variables in the configuration + file. This is useful when zdaemon is used to run programs that need + environment variables set (e.g. LD_LIBRARY_PATH). - - transcript log +- Added a command to rotate the transcript log. - - working directory - -Features - -- environment variables - -- transcript log rotation - -Bugs - -- help command - - zdaemon 2.0a1 (2006/12/21) == @@ -105,3 +95,16 @@ - SVN tag: svn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 - Tagged to make better 'svn:externals' linkage possible. + +To-Dos +== + +More docs: + +- Document/demonstrate some important features, such as: + + - working directory + +Bugs + +- help command Modified: zdaemon/trunk/README.txt === --- zdaemon/trunk/README.txt2007-01-10 10:16:55 UTC (rev 71853) +++ zdaemon/trunk/README.txt2007-01-10 11:36:01 UTC (rev 71854) @@ -1,11 +1,10 @@ - -``zdaemon`` process controller for Unix-ased systems - +* +``zdaemon`` process controller for Unix-based systems +* -Overview - +.. contents:: -'zdaemon' is a Python package which provides APIs for managing spplications +'zdaemon' is a Python package which provides APIs for managing applications run as daemons. Its principal use to date has been to manage the application server and storage server daemons for Zope / ZEO, although it is not limited to running Python-based applications (for instance, it has been used to Modified: zdaemon/trunk/setup.py === --- zdaemon/trunk/setup.py 2007-01-10 10:16:55 UTC (rev 71853) +++ zdaemon/trunk/setup.py 2007-01-10 11:36:01 UTC (rev 71854) @@ -29,7 +29,6 @@ entry_points=entry_points, include_package_data = True, install_requires=[ZConfig], -tests_require=[zope.testing], ) except ImportError: from distutils.core import setup @@ -38,7 +37,7 @@ name = zdaemon setup( name=name, -version=2.0a1, +version=2.0a2, url=http://www.python.org/pypi/zdaemon;, license=ZPL 2.1, description= @@ -53,7 +52,7 @@ 'Detailed Documentation\n' '**\n' + '\n' + -read('src', 'zdaemon', 'README.txt') +read('src/zdaemon/README.txt') + '\n' + 'Download\n' '**\n' @@ -61,5 +60,13 @@ packages=[zdaemon, zdaemon.tests], package_dir={: src}, +classifiers = [ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Zope Public License', + 'Topic :: Utilities', + 'Operating System :: POSIX', + ], **setuptools_options) Modified: zdaemon/trunk/src/zdaemon/README.txt === --- zdaemon/trunk/src/zdaemon/README.txt2007-01-10 10:16:55 UTC (rev 71853) +++ zdaemon/trunk/src/zdaemon/README.txt2007-01-10 11:36:01 UTC (rev 71854) @@ -7,7 +7,7 @@ Using zdaemon requires specifying a number of options, which can be given in a configuration file, or as command-line options. It also -accepts commands teling it what do do. The commants are: +accepts commands teling it what do do. The commands are: start Start a process as a daemon @@ -27,6 +27,10 @@ kill signal Send a signal to the daemon process +reopen_transcript +Reopen the transcript
[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/ Accept duplicate command-line options to work with scripts that embed
Log message for revision 71890: Accept duplicate command-line options to work with scripts that embed configuration options, such as the name of the configuration file. Changed: U zdaemon/trunk/src/zdaemon/tests/tests.py U zdaemon/trunk/src/zdaemon/zdctl.py U zdaemon/trunk/src/zdaemon/zdoptions.py -=- Modified: zdaemon/trunk/src/zdaemon/tests/tests.py === --- zdaemon/trunk/src/zdaemon/tests/tests.py2007-01-10 18:26:21 UTC (rev 71889) +++ zdaemon/trunk/src/zdaemon/tests/tests.py2007-01-10 18:27:06 UTC (rev 71890) @@ -63,8 +63,29 @@ +def allow_duplicate_arguments(): + + +Wrapper scripts will often embed configuration arguments. This could +cause a problem when zdaemon reinvokes itself, passing it's own set of +configuration arguments. To deal with this, we'll allow duplicate +arguments that have the same values. + open('conf', 'w').write( +... ''' +... runner +... program sleep 10 +... /runner +... ''') + system(./zdaemon -Cconf -Cconf -Cconf start) +. daemon process started, pid=21446 + + system(./zdaemon -Cconf -Cconf -Cconf stop) +daemon process stopped + + + def setUp(test): test.globs['_td'] = td = [] here = os.getcwd() Modified: zdaemon/trunk/src/zdaemon/zdctl.py === --- zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-10 18:26:21 UTC (rev 71889) +++ zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-10 18:27:06 UTC (rev 71890) @@ -223,7 +223,7 @@ args = [self.options.python, self.options.zdrun] else: args = [self.options.python, sys.argv[0]] -os.environ['ZDAEMON_MODE'] = '1' +os.environ['DAEMON_MANAGER_MODE'] = '1' args += self._get_override(-S, schemafile) args += self._get_override(-C, configfile) @@ -605,7 +605,7 @@ if args is None: args = sys.argv[1:] -if os.environ.get('ZDAEMON_MODE'): +if os.environ.get('DAEMON_MANAGER_MODE'): import zdaemon.zdrun return zdaemon.zdrun.main(args) Modified: zdaemon/trunk/src/zdaemon/zdoptions.py === --- zdaemon/trunk/src/zdaemon/zdoptions.py 2007-01-10 18:26:21 UTC (rev 71889) +++ zdaemon/trunk/src/zdaemon/zdoptions.py 2007-01-10 18:27:06 UTC (rev 71890) @@ -246,6 +246,10 @@ self.usage(invalid value for %s %r: %s % (opt, arg, msg)) if name and arg is not None: if getattr(self, name) is not None: +if getattr(self, name) == arg: +# Repeated option, but we don't mind because it +# just reinforces what we have. +continue self.usage(conflicting command line option %r % opt) setattr(self, name, arg) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/ Updated release info.
Log message for revision 71892: Updated release info. Changed: U zdaemon/trunk/CHANGES.txt U zdaemon/trunk/setup.py -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2007-01-10 18:28:09 UTC (rev 71891) +++ zdaemon/trunk/CHANGES.txt 2007-01-10 18:28:15 UTC (rev 71892) @@ -1,8 +1,8 @@ zdaemon Changelog * -zdaemon 2.0a4 (2007/01/10) -== +zdaemon 2.0a4, 2.0a5 (2007/01/10) += Bugs Fixed -- Modified: zdaemon/trunk/setup.py === --- zdaemon/trunk/setup.py 2007-01-10 18:28:09 UTC (rev 71891) +++ zdaemon/trunk/setup.py 2007-01-10 18:28:15 UTC (rev 71892) @@ -37,7 +37,7 @@ name = zdaemon setup( name=name, -version=2.0a4, +version=2.0a5, url=http://www.python.org/pypi/zdaemon;, license=ZPL 2.1, description= ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/ Added reference documentation and some edge-case tests.
Log message for revision 71789: Added reference documentation and some edge-case tests. Refined code in the control (user-interface) progream to detect sooner if the deamon manager has exited. Updated release info. Changed: U zdaemon/trunk/CHANGES.txt U zdaemon/trunk/README.txt U zdaemon/trunk/setup.py U zdaemon/trunk/src/zdaemon/README.txt U zdaemon/trunk/src/zdaemon/tests/tests.py U zdaemon/trunk/src/zdaemon/zdctl.py -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2007-01-08 00:10:56 UTC (rev 71788) +++ zdaemon/trunk/CHANGES.txt 2007-01-08 11:59:13 UTC (rev 71789) @@ -4,12 +4,6 @@ To-Dos == -Tests: - -- non-daemon mode - -- no infinite loop when program fails on start - More docs: - Document/demonstrate some important features, such as: @@ -18,9 +12,6 @@ - working directory -- Reference docs - - Features - environment variables Modified: zdaemon/trunk/README.txt === --- zdaemon/trunk/README.txt2007-01-08 00:10:56 UTC (rev 71788) +++ zdaemon/trunk/README.txt2007-01-08 11:59:13 UTC (rev 71789) @@ -1,8 +1,9 @@ -``zdaemon`` process controller -== + +``zdaemon`` process controller for Unix-ased systems + Overview - + 'zdaemon' is a Python package which provides APIs for managing spplications run as daemons. Its principal use to date has been to manage the application Modified: zdaemon/trunk/setup.py === --- zdaemon/trunk/setup.py 2007-01-08 00:10:56 UTC (rev 71788) +++ zdaemon/trunk/setup.py 2007-01-08 11:59:13 UTC (rev 71789) @@ -16,8 +16,7 @@ entry_points = [console_scripts] -zdctl = zdaemon.zdctl:main -zdrun = zdaemon.zdrun:main +zdaemon = zdaemon.zdctl:main def read(*rnames): @@ -29,6 +28,8 @@ zip_safe=False, entry_points=entry_points, include_package_data = True, +install_requires=[ZConfig], +tests_require=[zope.testing], ) except ImportError: from distutils.core import setup @@ -37,10 +38,11 @@ name = zdaemon setup( name=name, -version=1.4a2, +version=2.0a1, url=http://www.python.org/pypi/zdaemon;, license=ZPL 2.1, -description=Daemon process control library and tools, +description= +Daemon process control library and tools for Unix-bases systems, author=Zope Corporation and Contributors, author_email=zope3-dev@zope.org, long_description=( @@ -48,13 +50,16 @@ + '\n' + read('CHANGES.txt') + '\n' + +'Detailed Documentation\n' +'**\n' ++ '\n' + +read('src', 'zdaemon', 'README.txt') ++ '\n' + 'Download\n' '**\n' ), packages=[zdaemon, zdaemon.tests], package_dir={: src}, -install_requires=[ZConfig], -tests_require=[zope.testing], **setuptools_options) Modified: zdaemon/trunk/src/zdaemon/README.txt === --- zdaemon/trunk/src/zdaemon/README.txt2007-01-08 00:10:56 UTC (rev 71788) +++ zdaemon/trunk/src/zdaemon/README.txt2007-01-08 11:59:13 UTC (rev 71789) @@ -137,3 +137,192 @@ system(./zdaemon -Cconf stop) daemon process stopped +Reference Documentation +--- + +The following options are available for use in the runner section of +configuration files and as command-line options. + +program +Command-line option: -p or --program + +This option gives the command used to start the subprocess +managed by zdaemon. This is currently a simple list of +whitespace-delimited words. The first word is the program +file, subsequent words are its command line arguments. If the +program file contains no slashes, it is searched using $PATH. +(Note that there is no way to to include whitespace in the program +file or an argument, and under certain circumstances other +shell metacharacters are also a problem.) + +socket-name +Command-line option: -s or --socket-name. + +The pathname of the Unix domain socket used for communication +between the zdaemon command-line tool and a deamon-management +process. The default is relative to the current directory in +which zdaemon is started. You want to specify +an absolute pathname here. + +This defaults to zdsock, which is created in the directory +in which zdrun is started. + +daemon +Command-line option: -d or --daemon. + +If this option is true, zdaemon runs in the background as a +
[Zope-Checkins] SVN: zdaemon/branches/jim-env/ devel branch to add ability to set environment variables in zdaemon conf file
Log message for revision 71791: devel branch to add ability to set environment variables in zdaemon conf file Changed: A zdaemon/branches/jim-env/ -=- Copied: zdaemon/branches/jim-env (from rev 71790, zdaemon/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/branches/jim-env/src/zdaemon/ Finished adding support for setting environment variables.
Log message for revision 71825: Finished adding support for setting environment variables. Changed: U zdaemon/branches/jim-env/src/zdaemon/README.txt U zdaemon/branches/jim-env/src/zdaemon/component.xml U zdaemon/branches/jim-env/src/zdaemon/tests/tests.py -=- Modified: zdaemon/branches/jim-env/src/zdaemon/README.txt === --- zdaemon/branches/jim-env/src/zdaemon/README.txt 2007-01-08 18:48:35 UTC (rev 71824) +++ zdaemon/branches/jim-env/src/zdaemon/README.txt 2007-01-08 19:19:35 UTC (rev 71825) @@ -27,6 +27,10 @@ kill signal Send a signal to the daemon process +reopen_transcript +Reopen the transcript log. See the discussion of the transacriot +log below. + help command Get help on a command @@ -137,8 +141,6 @@ system(./zdaemon -Cconf stop) daemon process stopped - - Environment Variables - @@ -146,7 +148,6 @@ a program. Perhaps the most common case for this is setting LD_LIBRARY_PATH so that dynamically loaded libraries can be found. - open('conf', 'w').write( ... ''' ... runner @@ -154,14 +155,25 @@ ... socket-name /tmp/demo.zdsock ... /runner ... environment -... LD_LIBRARY_PATH = /home/foo/lib -... HOME = /home/foo +... LD_LIBRARY_PATH /home/foo/lib +... HOME /home/foo ... /environment ... ''') system(./zdaemon -Cconf fg) +env +USER=jim +HOME=/home/foo +LOGNAME=jim +USERNAME=jim +TERM=dumb +PATH=/home/jim/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin +EMACS=t +LANG=en_US.UTF-8 +SHELL=/bin/bash +EDITOR=emacs +LD_LIBRARY_PATH=/home/foo/lib - Reference Documentation --- Modified: zdaemon/branches/jim-env/src/zdaemon/component.xml === --- zdaemon/branches/jim-env/src/zdaemon/component.xml 2007-01-08 18:48:35 UTC (rev 71824) +++ zdaemon/branches/jim-env/src/zdaemon/component.xml 2007-01-08 19:19:35 UTC (rev 71825) @@ -272,7 +272,7 @@ /sectiontype - sectiontype name=environment + sectiontype name=environment keytype=string key name=+ attribute=mapping required=no Modified: zdaemon/branches/jim-env/src/zdaemon/tests/tests.py === --- zdaemon/branches/jim-env/src/zdaemon/tests/tests.py 2007-01-08 18:48:35 UTC (rev 71824) +++ zdaemon/branches/jim-env/src/zdaemon/tests/tests.py 2007-01-08 19:19:35 UTC (rev 71825) @@ -98,6 +98,11 @@ print o.read(), +def checkenv(match): +match = [a for a in match.group(1).split('\n')[:-1] + if a.split('=')[0] in ('HOME', 'LD_LIBRARY_PATH')] +match.sort() +return '\n'.join(match) + '\n' def test_suite(): return unittest.TestSuite(( @@ -112,6 +117,7 @@ setUp=setUp, tearDown=tearDown, checker=renormalizing.RENormalizing([ (re.compile('pid=\d+'), 'pid=NNN'), +(re.compile('^env\n((\w+=[^\n]*\n)+)$'), checkenv), ]) ), )) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/ Bugs Fixed
Log message for revision 71643: Bugs Fixed -- - In non-daemon mode, start hung, producing annoying dots when the program exited. - The start command hung producing annoying dots if the deamon failed to start. - foreground and start had different semantics because one used os.system and another used os.spawn New Features - Documentation - Command-line arguments can now be supplied to the start and foreground (fg) commands - zdctl now invokes itself to run zdrun. This means that it's no-longer necessary to generate a separate zdrun script. This especially when the magic techniques to find and run zdrun using directory sniffing fail to set the path corrrectly. - The daemon mode is now enabled by default. To get non-deamon mode, you have to use a configuration file and set deamon to off there. The old -d option is kept for backward compatibility, but is a no-op. Changed: U zdaemon/trunk/CHANGES.txt A zdaemon/trunk/src/zdaemon/README.txt U zdaemon/trunk/src/zdaemon/component.xml A zdaemon/trunk/src/zdaemon/tests/tests.py U zdaemon/trunk/src/zdaemon/zdctl.py U zdaemon/trunk/src/zdaemon/zdoptions.py -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2006-12-21 17:27:38 UTC (rev 71642) +++ zdaemon/trunk/CHANGES.txt 2006-12-21 23:46:14 UTC (rev 71643) @@ -1,19 +1,88 @@ zdaemon Changelog -= +* +To-Dos +== + +Tests: + +- non-daemon mode + +- no infinite loop when program fails on start + +More docs: + +- Document/demonstrate some important features, such as: + + - transcript log + + - working directory + +- Reference docs + + +Features + +- environment variables + +- transcript log rotation + +Bugs + +- help command + + +zdaemon 2.0a1 (2006/12/21) +== + +Bugs Fixed +-- + +- In non-daemon mode, start hung, producing annoying dots + when the program exited. + +- The start command hung producing annoying dots if the deamon failed + to start. + +- foreground and start had different semantics because one used + os.system and another used os.spawn + +New Features + + +- Documentation + +- Command-line arguments can now be supplied to the start and + foreground (fg) commands + +- zdctl now invokes itself to run zdrun. This means that it's + no-longer necessary to generate a separate zdrun script. This + especially when the magic techniques to find and run zdrun using + directory sniffing fail to set the path corrrectly. + +- The daemon mode is now enabled by default. To get non-deamon mode, + you have to use a configuration file and set deamon to off + there. The old -d option is kept for backward compatibility, but is + a no-op. + +zdaemon 1.4a1 (2005/11/21) +== + +Fixed a bug in the distribution setup file. + zdaemon 1.4a1 (2005/11/05) --- +== First semi-formal release. After some unknown release(???) +=== - Made 'zdaemon.zdoptions' not fail for --help when __main__.__doc__ is None. After zdaemon 1.1 -- += - Updated test 'testRunIgnoresParentSignals': @@ -40,7 +109,7 @@ forceful warning. zdaemon 1.1 (2005/06/09) - + - SVN tag: svn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 Added: zdaemon/trunk/src/zdaemon/README.txt === --- zdaemon/trunk/src/zdaemon/README.txt2006-12-21 17:27:38 UTC (rev 71642) +++ zdaemon/trunk/src/zdaemon/README.txt2006-12-21 23:46:14 UTC (rev 71643) @@ -0,0 +1,139 @@ +Using zdaemon += + +zdaemon provides a script, zdaemon, that can be used to running other +programs as POSIX (Unix) daemons. (Of course, it is only usable on +POSIX-complient systems. + +Using zdaemon requires specifying a number of options, which can be +given in a configuration file, or as command-line options. It also +accepts commands teling it what do do. The commants are: + +start +Start a process as a daemon + +stop +Stop a running daemon process + +restart +Stop and then restart a program + +status +Find out if the program is running + +foreground or fg +Run a program + +kill signal +Send a signal to the daemon process + +help command +Get help on a command + + +Commands can be given on a command line, or can be given using an +interactive interpreter. + +Let's start with a simple example. We'll use command-line options to +run the echo command: + + system(./zdaemon -p 'echo hello world' fg) +echo hello world +hello world + +Here we used the -p option to specify a program to run. We can +specify a program name and
[Zope-Checkins] SVN: zdaemon/trunk/test.py Let the buildout generate a test script.
Log message for revision 71079: Let the buildout generate a test script. Changed: D zdaemon/trunk/test.py -=- Deleted: zdaemon/trunk/test.py === --- zdaemon/trunk/test.py 2006-11-05 17:43:26 UTC (rev 71078) +++ zdaemon/trunk/test.py 2006-11-05 17:43:30 UTC (rev 71079) @@ -1,34 +0,0 @@ -## -# -# Copyright (c) 2004 Zope Corporation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -## -Test script - -For help, use -h - -$Id$ - - -import os, sys - -src = os.path.join(os.path.split(sys.argv[0])[0], 'src') -sys.path.insert(0, src) # put at beginning to avoid one in site_packages - -from zope.testing import testrunner - -defaults = [ -'--path', src, -'--tests-pattern', '^tests$', -'--package', 'zdaemon' -] - -sys.exit(testrunner.run(defaults)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/CHANGES.txt Added, um, release info.
Log message for revision 71080: Added, um, release info. Changed: U zdaemon/trunk/CHANGES.txt -=- Modified: zdaemon/trunk/CHANGES.txt === --- zdaemon/trunk/CHANGES.txt 2006-11-05 17:43:30 UTC (rev 71079) +++ zdaemon/trunk/CHANGES.txt 2006-11-05 17:43:33 UTC (rev 71080) @@ -1,6 +1,11 @@ zdaemon Changelog = +zdaemon 1.4 (2005/11/??) + + +First semi-formal release. + After some unknown release(???) --- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/tests/ Pass PYTHONPATH to subprocesses. In the new buildout,
Log message for revision 71081: Pass PYTHONPATH to subprocesses. In the new buildout, ZConfig and zope packages aren't siblings of zdaemon and zdruns lame path guessting fails. In a modern world, scripts are generated by easy_install or buildout ahnd get paths set automatically. We need to phase out this magic path guessing. Changed: U zdaemon/trunk/src/zdaemon/tests/parent.py U zdaemon/trunk/src/zdaemon/tests/testzdrun.py -=- Modified: zdaemon/trunk/src/zdaemon/tests/parent.py === --- zdaemon/trunk/src/zdaemon/tests/parent.py 2006-11-05 17:43:33 UTC (rev 71080) +++ zdaemon/trunk/src/zdaemon/tests/parent.py 2006-11-05 17:43:36 UTC (rev 71081) @@ -27,7 +27,9 @@ flag = os.P_NOWAIT #cmd = ' '.join([sys.executable] + args) #print cmd -os.spawnvp(flag, args[0], args) +os.spawnvpe(flag, args[0], args, +dict(os.environ, PYTHONPATH=':'.join(sys.path)), +) while 1: # wait to be signaled time.sleep(1) Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py === --- zdaemon/trunk/src/zdaemon/tests/testzdrun.py2006-11-05 17:43:33 UTC (rev 71080) +++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py2006-11-05 17:43:36 UTC (rev 71081) @@ -233,13 +233,16 @@ tmp = tempfile.mkdtemp() zdrun_socket = os.path.join(tmp, 'testsock') try: -zdctlpid = os.spawnvp( +zdctlpid = os.spawnvpe( os.P_NOWAIT, sys.executable, -[sys.executable, os.path.join(self.here, 'parent.py'), tmp] +[sys.executable, os.path.join(self.here, 'parent.py'), tmp], +dict(os.environ, + PYTHONPATH=:.join(sys.path), + ) ) # Wait for it to start, but no longer than a minute. -deadline = time.time() + 60 +deadline = time.time() + 6000 is_started = False while time.time() deadline: response = send_action('status\n', zdrun_socket) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: zdaemon/tags/1.2/ Tag for Zope 3.3 release
Log message for revision 70121: Tag for Zope 3.3 release Changed: A zdaemon/tags/1.2/ -=- Copied: zdaemon/tags/1.2 (from rev 40792, zdaemon/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/utilities/tracelog.py Added url summary statistics.
Log message for revision 41497: Added url summary statistics. Added HTML output that makes it easy to jump from a URL shown in a minute detail to the statistics for that URL. Changed: U Zope/trunk/utilities/tracelog.py -=- Modified: Zope/trunk/utilities/tracelog.py === --- Zope/trunk/utilities/tracelog.py2006-01-30 16:18:33 UTC (rev 41496) +++ Zope/trunk/utilities/tracelog.py2006-01-30 16:31:04 UTC (rev 41497) @@ -11,15 +11,15 @@ # FOR A PARTICULAR PURPOSE. # ## -Yet another trace log analysis tool +Yet another lag analysis tool + + $Id$ import datetime, optparse, sys - - class Request: output_bytes = '-' @@ -52,6 +52,60 @@ def total_seconds(self): return (self.end - self.start).seconds +class Times: + +tid = 1l + +def __init__(self): +self.times = [] +self.hangs = 0 +Times.tid += 1 +self.tid = Times.tid # generate a unique id + +def finished(self, request): +self.times.append(request.app_seconds) + +def hung(self): +self.hangs += 1 + +def impact(self): +times = self.times +if not times: +self.median = self.mean = self.impact = 0 +return 0 +self.times.sort() +n = len(times) +if n % 2: +m = times[(n+1)/2-1] +else: +m = .5 * (times[n/2]+times[n/2-1]) +self.median = m +self.mean = sum(times)/n +self.impact = self.mean * (n+self.hangs) +return self.impact + +def __str__(self): +times = self.times +if not times: +return 0 %5d % ( +self.hangs) + +n = len(times) +m = self.median +return %9.1f %5d %6.0f %6.2f %6.2f %6.0f %5d % ( +self.impact, n, times[0], m, self.mean, times[-1], self.hangs) + +def html(self): +times = self.times +if not times: +print td('', 0, '', '', '', '', self.hangs) +else: +n = len(times) +m = self.median +impact = 'a name=u%s%s' % (self.tid, self.impact) +print td(impact, n, times[0], m, self.mean, times[-1], + self.hangs) + def parsedt(s): date, time = s.split('T') return datetime.datetime(*( @@ -69,15 +123,33 @@ restarts = find_restarts(options.event_log) else: restarts = [] - + restarts.append(datetime.datetime.utcnow()+datetime.timedelta(1000)) +if options.html: +print_app_requests = print_app_requests_html +output_minute = output_minute_html +output_stats = output_stats_html +minutes_header = minutes_header_html +minutes_footer = minutes_footer_html +print 'html title=trace log statisticsbody' +else: +print_app_requests = print_app_requests_text +output_minute = output_minute_text +output_stats = output_stats_text +minutes_header = minutes_header_text +minutes_footer = minutes_footer_text + + +urls = {} [file] = args lmin = ldt = None requests = {} input = apps = output = n = 0 spr = spa = 0.0 restart = restarts.pop(0) +minutes_header() +remove_prefix = options.remove_prefix for record in open(file): record = record.split() typ, rid, dt = record[:3] @@ -89,7 +161,9 @@ print_app_requests(requests, ldt, options.old_requests, options.app_requests, + urls, \nLeft over:) +record_hung(urls, requests) requests = {} input = apps = output = n = 0 spr = spa = 0.0 @@ -98,18 +172,12 @@ if min != lmin: if lmin is not None: - -print lmin.replace('T', ' '), %4d I=%3d A=%3d O=%3d % ( -len(requests), input, apps, output), -if n: -print N=%4d %10.2f %10.2f % (n, spr/n, spa/n) -else: -print - +output_minute(lmin, requests, input, apps, output, n, spr, spa) if apps options.apps: print_app_requests(requests, dt, options.old_requests, options.app_requests, + urls, ) lmin = min spr = 0.0 @@ -117,8 +185,23 @@ n = 0 if typ == 'B': +if rid in requests: +request = requests[rid] +if request.state ==
[Zope-Checkins] CVS: Zope - README.txt:1.16.2.3
Update of /cvs-repository/Zope In directory cvs.zope.org:/tmp/cvs-serv31547 Modified Files: Tag: Zope-2_7-branch README.txt Log Message: *** empty log message *** === Zope/README.txt 1.16.2.2 = 1.16.2.3 === --- Zope/README.txt:1.16.2.2Sat Mar 18 11:58:54 2006 +++ Zope/README.txt Sat Mar 18 12:02:15 2006 @@ -30,3 +30,4 @@ Installing Zope Follow the instructions in doc/INSTALL.txt to install Zope. + ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Zope - README.txt:1.16.2.4
Update of /cvs-repository/Zope In directory cvs.zope.org:/tmp/cvs-serv360 Modified Files: Tag: Zope-2_7-branch README.txt Log Message: Bogus checkin to test new mailing list. :) === Zope/README.txt 1.16.2.3 = 1.16.2.4 === --- Zope/README.txt:1.16.2.3Sat Mar 18 12:02:15 2006 +++ Zope/README.txt Sat Mar 18 12:06:38 2006 @@ -30,4 +30,3 @@ Installing Zope Follow the instructions in doc/INSTALL.txt to install Zope. - ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Cruft/ExtensionClass/src - Acquisition.c:1.61.4.1.32.1
Update of /cvs-repository/Cruft/ExtensionClass/src In directory cvs.zope.org:/tmp/cvs-serv6895 Modified Files: Tag: zc-Zope-2-7-5 Acquisition.c Log Message: Backported fix fromn trunk. The simplification of wrappers is not merely an optimization. It is critical for getting correct wrapper semantics. === Cruft/ExtensionClass/src/Acquisition.c 1.61.4.1 = 1.61.4.1.32.1 === --- Cruft/ExtensionClass/src/Acquisition.c:1.61.4.1 Tue Oct 21 08:44:39 2003 +++ Cruft/ExtensionClass/src/Acquisition.c Tue Mar 7 17:56:25 2006 @@ -138,39 +138,6 @@ /* */ -static PyObject * -__of__(PyObject *inst, PyObject *parent) -{ - PyObject *r, *t; - - UNLESS(r=PyObject_GetAttr(inst, py__of__)) return NULL; - UNLESS(t=PyTuple_New(1)) goto err; - PyTuple_SET_ITEM(t,0,parent); - ASSIGN(r,PyObject_CallObject(r,t)); - PyTuple_SET_ITEM(t,0,NULL); - Py_DECREF(t); - - if (r - r-ob_refcnt==1 - isWrapper(r) - WRAPPER(r)-container isWrapper(WRAPPER(r)-container) - ) -while (WRAPPER(r)-obj isWrapper(WRAPPER(r)-obj) - (WRAPPER(WRAPPER(r)-obj)-container == - WRAPPER(WRAPPER(r)-container)-obj) - ) - { - /* Simplify wrapper */ - Py_XINCREF(WRAPPER(WRAPPER(r)-obj)-obj); - ASSIGN(WRAPPER(r)-obj, WRAPPER(WRAPPER(r)-obj)-obj); - } - - return r; -err: - Py_DECREF(r); - return NULL; -} - static Wrapper *freeWrappers=0; static int nWrappers=0; #define MAX_CACHED_WRAPPERS 200 @@ -227,6 +194,49 @@ { PyObject_DEL(self); } +} + +static PyObject * +__of__(PyObject *inst, PyObject *parent) +{ + PyObject *r, *t; + + UNLESS(r=PyObject_GetAttr(inst, py__of__)) return NULL; + UNLESS(t=PyTuple_New(1)) goto err; + Py_INCREF(parent); + PyTuple_SET_ITEM(t,0,parent); + ASSIGN(r,PyObject_CallObject(r,t)); + Py_DECREF(t); + + if (r != NULL + isWrapper(r) + WRAPPER(r)-container isWrapper(WRAPPER(r)-container) + ) +while (WRAPPER(r)-obj isWrapper(WRAPPER(r)-obj) + (WRAPPER(WRAPPER(r)-obj)-container == + WRAPPER(WRAPPER(r)-container)-obj) + ) + { +if (r-ob_refcnt !=1 ) + { +t = newWrapper(WRAPPER(r)-obj, + WRAPPER(r)-container, + (r-ob_type)); +Py_DECREF(r); +if (t==NULL) + return NULL; +r = t; + } + +/* Simplify wrapper */ +Py_XINCREF(WRAPPER(WRAPPER(r)-obj)-obj); +ASSIGN(WRAPPER(r)-obj, WRAPPER(WRAPPER(r)-obj)-obj); + } + + return r; +err: + Py_DECREF(r); + return NULL; } static PyObject * ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/utilities/tracelog.py Added url summary statistics.
Log message for revision 41497: Added url summary statistics. Added HTML output that makes it easy to jump from a URL shown in a minute detail to the statistics for that URL. Changed: U Zope/trunk/utilities/tracelog.py -=- Modified: Zope/trunk/utilities/tracelog.py === --- Zope/trunk/utilities/tracelog.py2006-01-30 16:18:33 UTC (rev 41496) +++ Zope/trunk/utilities/tracelog.py2006-01-30 16:31:04 UTC (rev 41497) @@ -11,15 +11,15 @@ # FOR A PARTICULAR PURPOSE. # ## -Yet another trace log analysis tool +Yet another lag analysis tool + + $Id$ import datetime, optparse, sys - - class Request: output_bytes = '-' @@ -52,6 +52,60 @@ def total_seconds(self): return (self.end - self.start).seconds +class Times: + +tid = 1l + +def __init__(self): +self.times = [] +self.hangs = 0 +Times.tid += 1 +self.tid = Times.tid # generate a unique id + +def finished(self, request): +self.times.append(request.app_seconds) + +def hung(self): +self.hangs += 1 + +def impact(self): +times = self.times +if not times: +self.median = self.mean = self.impact = 0 +return 0 +self.times.sort() +n = len(times) +if n % 2: +m = times[(n+1)/2-1] +else: +m = .5 * (times[n/2]+times[n/2-1]) +self.median = m +self.mean = sum(times)/n +self.impact = self.mean * (n+self.hangs) +return self.impact + +def __str__(self): +times = self.times +if not times: +return 0 %5d % ( +self.hangs) + +n = len(times) +m = self.median +return %9.1f %5d %6.0f %6.2f %6.2f %6.0f %5d % ( +self.impact, n, times[0], m, self.mean, times[-1], self.hangs) + +def html(self): +times = self.times +if not times: +print td('', 0, '', '', '', '', self.hangs) +else: +n = len(times) +m = self.median +impact = 'a name=u%s%s' % (self.tid, self.impact) +print td(impact, n, times[0], m, self.mean, times[-1], + self.hangs) + def parsedt(s): date, time = s.split('T') return datetime.datetime(*( @@ -69,15 +123,33 @@ restarts = find_restarts(options.event_log) else: restarts = [] - + restarts.append(datetime.datetime.utcnow()+datetime.timedelta(1000)) +if options.html: +print_app_requests = print_app_requests_html +output_minute = output_minute_html +output_stats = output_stats_html +minutes_header = minutes_header_html +minutes_footer = minutes_footer_html +print 'html title=trace log statisticsbody' +else: +print_app_requests = print_app_requests_text +output_minute = output_minute_text +output_stats = output_stats_text +minutes_header = minutes_header_text +minutes_footer = minutes_footer_text + + +urls = {} [file] = args lmin = ldt = None requests = {} input = apps = output = n = 0 spr = spa = 0.0 restart = restarts.pop(0) +minutes_header() +remove_prefix = options.remove_prefix for record in open(file): record = record.split() typ, rid, dt = record[:3] @@ -89,7 +161,9 @@ print_app_requests(requests, ldt, options.old_requests, options.app_requests, + urls, \nLeft over:) +record_hung(urls, requests) requests = {} input = apps = output = n = 0 spr = spa = 0.0 @@ -98,18 +172,12 @@ if min != lmin: if lmin is not None: - -print lmin.replace('T', ' '), %4d I=%3d A=%3d O=%3d % ( -len(requests), input, apps, output), -if n: -print N=%4d %10.2f %10.2f % (n, spr/n, spa/n) -else: -print - +output_minute(lmin, requests, input, apps, output, n, spr, spa) if apps options.apps: print_app_requests(requests, dt, options.old_requests, options.app_requests, + urls, ) lmin = min spr = 0.0 @@ -117,8 +185,23 @@ n = 0 if typ == 'B': +if rid in requests: +request = requests[rid] +if request.state ==
[Zope-Checkins] SVN: Zope/trunk/utilities/tracelog.py Simple script to analyze trace logs.
Log message for revision 41425: Simple script to analyze trace logs. Changed: A Zope/trunk/utilities/tracelog.py -=- Added: Zope/trunk/utilities/tracelog.py === --- Zope/trunk/utilities/tracelog.py2006-01-24 22:36:17 UTC (rev 41424) +++ Zope/trunk/utilities/tracelog.py2006-01-24 23:38:54 UTC (rev 41425) @@ -0,0 +1,223 @@ +## +# +# Copyright (c) 2006 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +## +Yet another trace log analysis tool + +$Id$ + + +import datetime, optparse, sys + + + +class Request: + +output_bytes = '-' + +def __init__(self, start, method, url): +self.method = method +self.url = url +self.start = start +self.state = 'input' + +def I(self, input_time, input_bytes): +self.input_time = input_time +self.input_bytes = input_bytes +self.state = 'app' + +def A(self, app_time, response, output_bytes): +self.app_time = app_time +self.response = response +self.output_bytes = output_bytes +self.state = 'output' + +def E(self, end): +self.end = end + +@property +def app_seconds(self): +return (self.app_time - self.input_time).seconds + +@property +def total_seconds(self): +return (self.end - self.start).seconds + +def parsedt(s): +date, time = s.split('T') +return datetime.datetime(*( +map(int, date.split('-')) ++ +map(int, time.split(':')) +)) + +def main(args=None): +if args is None: +args = sys.argv[1:] + +options, args = parser.parse_args(args) +if options.event_log: +restarts = find_restarts(options.event_log) +else: +restarts = [] + +restarts.append(datetime.datetime.utcnow()+datetime.timedelta(1000)) + +[file] = args +lmin = ldt = None +requests = {} +input = apps = output = n = 0 +spr = spa = 0.0 +restart = restarts.pop(0) +for record in open(file): +record = record.split() +typ, rid, dt = record[:3] +min = dt[:-3] +dt = parsedt(dt) +if dt == restart: +continue +while dt restart: +print_app_requests(requests, ldt, + options.old_requests, + options.app_requests, + \nLeft over:) +requests = {} +input = apps = output = n = 0 +spr = spa = 0.0 +restart = restarts.pop(0) +ldt = dt + +if min != lmin: +if lmin is not None: + +print lmin.replace('T', ' '), %4d I=%3d A=%3d O=%3d % ( +len(requests), input, apps, output), +if n: +print N=%4d %10.2f %10.2f % (n, spr/n, spa/n) +else: +print + +if apps options.apps: +print_app_requests(requests, dt, + options.old_requests, + options.app_requests, + ) +lmin = min +spr = 0.0 +spa = 0.0 +n = 0 + +if typ == 'B': +input += 1 +requests[rid] = Request(dt, *record[3:5]) +elif typ == 'I': +if rid in requests: +input -= 1 +apps += 1 +requests[rid].I(dt, record[3]) +elif typ == 'A': +if rid in requests: +apps -= 1 +output += 1 +requests[rid].A(dt, *record[3:5]) +elif typ == 'E': +if rid in requests: +output -= 1 +request = requests.pop(rid) +request.E(dt) +spr += request.total_seconds +spa += request.app_seconds +n += 1 +else: +print 'WTF', record + +print_app_requests(requests, dt, + options.old_requests, + options.app_requests, + Left over:) + +def find_restarts(event_log): +result = [] +for l in open(event_log): +if l.strip().endswith(Zope Ready to handle requests): +
[Zope-Checkins] CVS: Packages/ZODB - config.py:1.13.4.1.38.4
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv23417 Modified Files: Tag: jim-test-storage config.py Log Message: Fixed bug in as-of handling. === Packages/ZODB/config.py 1.13.4.1.38.3 = 1.13.4.1.38.4 === --- Packages/ZODB/config.py:1.13.4.1.38.3 Fri Jan 20 17:15:22 2006 +++ Packages/ZODB/config.py Mon Jan 23 16:32:51 2006 @@ -133,6 +133,7 @@ y, m, d = map(int, d.split('-')) as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *map(int, t.split(':'))) +as_of = `as_of` read_only = True else: as_of = None ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Packages/ZODB - config.py:1.13.4.1.38.2
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv6069 Modified Files: Tag: jim-test-storage config.py Log Message: Make sure providing as-of implies read-only. === Packages/ZODB/config.py 1.13.4.1.38.1 = 1.13.4.1.38.2 === --- Packages/ZODB/config.py:1.13.4.1.38.1 Thu Jan 19 20:15:09 2006 +++ Packages/ZODB/config.py Fri Jan 20 13:29:27 2006 @@ -133,12 +133,14 @@ y, m, d = map(int, d.split('-')) as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *t.split(':')) +read_only = True else: as_of = None +read_only = self.config.read_only return FileStorage(self.config.path, create=self.config.create, - read_only=self.config.read_only, + read_only=read_only, quota=self.config.quota, stop=as_of, ) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Packages/ZODB - DemoStorage.py:1.18.10.2.4.1
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv15107/ZODB Modified Files: Tag: jim-test-storage DemoStorage.py Log Message: Added lastTransaction, which ZEO wants === Packages/ZODB/DemoStorage.py 1.18.10.2 = 1.18.10.2.4.1 === --- Packages/ZODB/DemoStorage.py:1.18.10.2 Fri Apr 22 15:36:07 2005 +++ Packages/ZODB/DemoStorage.pyFri Jan 20 17:15:19 2006 @@ -87,6 +87,7 @@ from TimeStamp import TimeStamp from cPickle import loads from BTrees import OOBTree +from ZODB.utils import z64 class DemoStorage(BaseStorage): @@ -105,6 +106,8 @@ raise POSException.StorageError, ( Demo base storage has version data) +self._ltid = z64 + # While we officially don't support wrapping a non-read-only base # storage, it has proved useful for test suites to wrap a ClientStorage # in DemoStorage. The least we can do to help support that case is @@ -322,6 +325,12 @@ if v is None: v = self._vindex[version] = {} v[oid] = r + +self._ltid = tid + +def lastTransaction(self): +Return transaction id for last committed transaction +return self._ltid def undo(self, transaction_id): self._lock_acquire() ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Packages/ZODB - BaseStorage.py:1.34.4.6.2.1
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv15074/ZODB Modified Files: Tag: jim-test-storage BaseStorage.py Log Message: Should be OK to ask for new_oid in read-only mode. Demo storage wants it. Maybe need a max_oid. === Packages/ZODB/BaseStorage.py 1.34.4.6 = 1.34.4.6.2.1 === --- Packages/ZODB/BaseStorage.py:1.34.4.6 Wed Oct 5 15:31:01 2005 +++ Packages/ZODB/BaseStorage.pyFri Jan 20 17:15:18 2006 @@ -94,8 +94,6 @@ return '' def new_oid(self): -if self._is_read_only: -raise POSException.ReadOnlyError() self._lock_acquire() try: last = self._oid ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Packages/ZODB - config.py:1.13.4.1.38.3
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv15174/ZODB Modified Files: Tag: jim-test-storage config.py Log Message: Args to TimeStamp must be ints. === Packages/ZODB/config.py 1.13.4.1.38.2 = 1.13.4.1.38.3 === --- Packages/ZODB/config.py:1.13.4.1.38.2 Fri Jan 20 13:29:27 2006 +++ Packages/ZODB/config.py Fri Jan 20 17:15:22 2006 @@ -17,11 +17,11 @@ import os from cStringIO import StringIO -import ZODB.Timestamp import ZConfig import ZODB +import ZODB.TimeStamp db_schema_path = os.path.join(ZODB.__path__[0], config.xml) _db_schema = None @@ -132,7 +132,7 @@ d, t = as_of, '0' y, m, d = map(int, d.split('-')) -as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *t.split(':')) +as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *map(int, t.split(':'))) read_only = True else: as_of = None ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Packages/ZODB - component.xml:1.10.6.3.8.1 config.py:1.13.4.1.38.1
Update of /cvs-repository/Packages/ZODB In directory cvs.zope.org:/tmp/cvs-serv24275/ZODB Modified Files: Tag: jim-test-storage component.xml config.py Log Message: First cut at as-of option to open to a specific point in time. === Packages/ZODB/component.xml 1.10.6.3 = 1.10.6.3.8.1 === --- Packages/ZODB/component.xml:1.10.6.3Fri Nov 26 14:36:44 2004 +++ Packages/ZODB/component.xml Thu Jan 19 20:15:09 2006 @@ -35,6 +35,13 @@ raised. /description /key +key name=as-of datatype=string + description +The as-of option allows opening a storage at a particilar +time in it's history. The argument is a date-time of the form: +-MM-DDTHH:MM:SS. + /description +/key /sectiontype sectiontype name=mappingstorage datatype=.MappingStorage === Packages/ZODB/config.py 1.13.4.1 = 1.13.4.1.38.1 === --- Packages/ZODB/config.py:1.13.4.1Mon Sep 15 14:02:58 2003 +++ Packages/ZODB/config.py Thu Jan 19 20:15:09 2006 @@ -17,6 +17,7 @@ import os from cStringIO import StringIO +import ZODB.Timestamp import ZConfig @@ -122,10 +123,25 @@ def open(self): from ZODB.FileStorage import FileStorage + +as_of = self.config.as_of +if as_of: +if 'T' in as_of: +d, t = as_of.split('T') +else: +d, t = as_of, '0' + +y, m, d = map(int, d.split('-')) +as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *t.split(':')) +else: +as_of = None + return FileStorage(self.config.path, create=self.config.create, read_only=self.config.read_only, - quota=self.config.quota) + quota=self.config.quota, + stop=as_of, + ) class ZEOClient(BaseConfig): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
Re: [Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/ integrate Z3 ZPT into Z2
That was quick. Go Andreas! Andreas Jung wrote: Log message for revision 40643: integrate Z3 ZPT into Z2 Changed: A Zope/branches/ajung-zpt-integration/ -=- Copied: Zope/branches/ajung-zpt-integration (from rev 40642, Zope/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/ Incorporated test runner bug fixes:
Log message for revision 39833: Incorporated test runner bug fixes: - --verbose --progress didn't do what people expected - --module matched module file paths rather than module dotted names - Positional arguments weren't handled correctly Changed the test-runner script, test.py to exclude packages currently gotten via externals. Changed: _U Zope/trunk/lib/python/zope/ U Zope/trunk/test.py -=- Property changes on: Zope/trunk/lib/python/zope ___ Name: svn:externals - app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing -r39736 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread + app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing
[Zope-Checkins] SVN: Zope/trunk/lib/python/zope/ Integrated a newer zope.testing that fixed handling if the --package
Log message for revision 39739: Integrated a newer zope.testing that fixed handling if the --package (--dir, -s) option with Products. Changed: _U Zope/trunk/lib/python/zope/ -=- Property changes on: Zope/trunk/lib/python/zope ___ Name: svn:externals - app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing -r39704 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread + app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing -r39736 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread ___
[Zope-Checkins] SVN: zdaemon/trunk/src/ Created separate src dir
Log message for revision 39723: Created separate src dir Changed: A zdaemon/trunk/src/ A zdaemon/trunk/src/zdaemon/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/zope/ Changed to use a tag that has a fix for a test_suite that returned
Log message for revision 39699: Changed to use a tag that has a fix for a test_suite that returned None. Changed: _U Zope/trunk/lib/python/zope/ -=- Property changes on: Zope/trunk/lib/python/zope ___ Name: svn:externals - app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing -r39604 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread + app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing -r39604 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread ___ Zope-Checkins maillist - Zope-Checkins@zope.org
[Zope-Checkins] SVN: Zope/trunk/lib/python/zope/ testing buildbot
Log message for revision 39702: testing buildbot Changed: _U Zope/trunk/lib/python/zope/ -=- Property changes on: Zope/trunk/lib/python/zope ___ Name: buildbot:was - here ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/ Added protection against the (small) risk that someone could mitate an
Log message for revision 39645: Added protection against the (small) risk that someone could mitate an object through an augmented assignment (aka inplace) operator. Changed: U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ZopeGuards.py U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/actual_python.py U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py U Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after.py U Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/restricted_module.py U Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/security_in_syntax.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ZopeGuards.py === --- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ZopeGuards.py 2005-10-26 17:12:32 UTC (rev 39644) +++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ZopeGuards.py 2005-10-26 17:12:35 UTC (rev 39645) @@ -375,6 +375,112 @@ ob._guarded_writes = 1 return ob +try: +valid_inplace_types = list, set +except NameError: +# Python 2.3 +valid_inplace_types = list + +inplace_slots = { +'+=': '__iadd__', +'-=': '__isub__', +'*=': '__imul__', +'/=': (1/2 == 0) and '__idiv__' or '__itruediv__', +'//=': '__ifloordiv__', +'%=': '__imod__', +'**=': '__ipow__', +'=': '__ilshift__', +'=': '__irshift__', +'=': '__iand__', +'^=': '__ixor__', +'|=': '__ior_', +} + + +def __iadd__(x, y): +x += y +return x + +def __isub__(x, y): +x -= y +return x + +def __imul__(x, y): +x *= y +return x + +def __idiv__(x, y): +x /= y +return x + +def __ifloordiv__(x, y): +x //= y +return x + +def __imod__(x, y): +x %= y +return x + +def __ipow__(x, y): +x **= y +return x + +def __ilshift__(x, y): +x = y +return x + +def __irshift__(x, y): +x = y +return x + +def __iand__(x, y): +x = y +return x + +def __ixor__(x, y): +x ^= y +return x + +def __ior__(x, y): +x |= y +return x + + +inplace_ops = { +'+=': __iadd__, +'-=': __isub__, +'*=': __imul__, +'/=': __idiv__, +'//=': __ifloordiv__, +'%=': __imod__, +'**=': __ipow__, +'=': __ilshift__, +'=': __irshift__, +'=': __iand__, +'^=': __ixor__, +'|=': __ior__, +} + + +def protected_inplacevar(op, var, expr): +Do an inplace operation + +If the var has an inplace slot, then disallow the operation +unless the var is a list. + +if (hasattr(var, inplace_slots[op]) +and not isinstance(var, valid_inplace_types) +): +try: +cls = var.__class__ +except AttributeError: +cls = type(var) +raise TypeError( +Augmented assignment to %s objects is not allowed + in untrusted code % cls.__name__ +) +return inplace_ops[op](var, expr) + # AccessControl clients generally need to set up a safe globals dict for # use by restricted code. The get_safe_globals() function returns such # a dict, containing '__builtins__' mapped to our safe bulitins, and @@ -394,6 +500,7 @@ '_getiter_':guarded_iter, '_print_': RestrictedPython.PrintCollector, '_write_': full_write_guard, + '_inplacevar_': protected_inplacevar, # The correct implementation of _getattr_, aka # guarded_getattr, isn't known until # AccessControl.Implementation figures that out, then Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/actual_python.py === --- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/actual_python.py 2005-10-26 17:12:32 UTC (rev 39644) +++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/actual_python.py 2005-10-26 17:12:35 UTC (rev 39645) @@ -157,3 +157,9 @@ def f10(): assert iter(enumerate(iter(iter(range(9).next() == (0, 0) f10() + +def f11(): +x = 1 +x += 1 +f11() + Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py === --- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py 2005-10-26 17:12:32 UTC (rev 39644) +++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py 2005-10-26 17:12:35 UTC (rev 39645) @@ -20,6 +20,7 @@ import os, sys import unittest +from zope.testing import doctest import ZODB import AccessControl.SecurityManagement from AccessControl.SimpleObjectPolicies import ContainerAssertions @@ -671,8 +672,90 @@ if callable(v) and v is not
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py Added tests for handling generator expressions.
Log message for revision 39646: Added tests for handling generator expressions. Changed: A Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py -=- Copied: Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py (from rev 39505, Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after.py) === --- Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after.py 2005-10-18 17:17:55 UTC (rev 39505) +++ Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py 2005-10-26 17:12:37 UTC (rev 39646) @@ -0,0 +1,41 @@ +## +# +# Copyright (c) 2003 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +## +Restricted Python transformation examples + +This module contains pairs of functions. Each pair has a before and an +after function. The after function shows the source code equivalent +of the before function after it has been modified by the restricted +compiler. + +These examples are actually used in the testRestrictions.py +checkBeforeAndAfter() unit tests, which verifies that the restricted compiler +actually produces the same output as would be output by the normal compiler +for the after function. + +$Id$ + + +def simple_generator_expression_before(): +x = (y**2 for y in whatever if y 3) + +def simple_generator_expression_after(): +x = (y**2 for y in _getiter_(whatever) if y 3) + +def nested_generator_expression_before(): +x = (x**2 + y**2 for x in whatever1 if x = 0 + for y in whatever2 if y = x) + +def nested_generator_expression_after(): +x = (x**2 + y**2 for x in _getiter_(whatever1) if x = 0 + for y in _getiter_(whatever2) if y = x) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/testRestrictions.py Fixed a bug in getting source that prevented tests from being used if
Log message for revision 39647: Fixed a bug in getting source that prevented tests from being used if there were pyc files around. Sigh. Added tests for restrictions on augmented assignment and for handling generator expressions. Changed: U Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/testRestrictions.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/testRestrictions.py === --- Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/testRestrictions.py 2005-10-26 17:12:37 UTC (rev 39646) +++ Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/testRestrictions.py 2005-10-26 17:12:39 UTC (rev 39647) @@ -12,7 +12,7 @@ from RestrictedPython import compile_restricted, PrintCollector from RestrictedPython.Eval import RestrictionCapableEval -from RestrictedPython.tests import before_and_after, restricted_module, verify +from RestrictedPython.tests import restricted_module, verify from RestrictedPython.RCompile import RModule, RFunction try: @@ -51,8 +51,13 @@ return fn, msg def get_source(func): -Less silly interface to find_source # Sheesh -return find_source(func.func_globals['__file__'], func.func_code)[1] +Less silly interface to find_source +file = func.func_globals['__file__'] +if file.endswith('.pyc'): +file = file[:-1] +source = find_source(file, func.func_code)[1] +assert source.strip(), Source should not be empty! +return source def create_rmodule(): global rmodule @@ -175,6 +180,14 @@ apply_wrapper_called.append('yes') return func(*args, **kws) +inplacevar_wrapper_called = {} +def inplacevar_wrapper(op, x, y): +inplacevar_wrapper_called[op] = x, y +# This is really lame. But it's just a test. :) +globs = {'x': x, 'y': y} +exec 'x'+op+'y' in globs +return globs['x'] + class RestrictionTests(unittest.TestCase): def execFunc(self, name, *args, **kw): func = rmodule[name] @@ -191,6 +204,7 @@ # work for everything. '_getiter_': list, '_apply_': apply_wrapper, + '_inplacevar_': inplacevar_wrapper, }) return func(*args, **kw) @@ -243,6 +257,11 @@ self.assertEqual(apply_wrapper_called, [yes]) self.assertEqual(res, 321) +def checkInplace(self): +inplacevar_wrapper_called.clear() +res = self.execFunc('try_inplace') +self.assertEqual(inplacevar_wrapper_called['+='], (1, 3)) + def checkDenied(self): for k in rmodule.keys(): if k[:6] == 'denied': @@ -314,7 +333,7 @@ def checkBeforeAndAfter(self): from RestrictedPython.RCompile import RModule - +from RestrictedPython.tests import before_and_after from compiler import parse defre = re.compile(r'def ([_A-Za-z0-9]+)_(after|before)\(') @@ -339,6 +358,34 @@ rm.compile() verify.verify(rm.getCode()) +if sys.version_info[:2] = (2, 4): +def checkBeforeAndAfter24(self): +from RestrictedPython.RCompile import RModule +from RestrictedPython.tests import before_and_after24 +from compiler import parse + +defre = re.compile(r'def ([_A-Za-z0-9]+)_(after|before)\(') + +beforel = [name for name in before_and_after24.__dict__ + if name.endswith(_before)] + +for name in beforel: +before = getattr(before_and_after24, name) +before_src = get_source(before) +before_src = re.sub(defre, r'def \1(', before_src) +rm = RModule(before_src, '') +tree_before = rm._get_tree() + +after = getattr(before_and_after24, name[:-6]+'after') +after_src = get_source(after) +after_src = re.sub(defre, r'def \1(', after_src) +tree_after = parse(after_src) + +self.assertEqual(str(tree_before), str(tree_after)) + +rm.compile() +verify.verify(rm.getCode()) + def _compile_file(self, name): path = os.path.join(_HERE, name) f = open(path, r) @@ -355,7 +402,7 @@ def getiter(seq): calls.append(seq) return list(seq) -globals = {_getiter_: getiter} +globals = {_getiter_: getiter, '_inplacevar_': inplacevar_wrapper} exec co in globals, {} # The comparison here depends on the exact code that is # contained in unpack.py. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/jim-reintegrate-zope3/ Created branch to change the way Zope 3 is integrated at the zope package level
Log message for revision 39575: Created branch to change the way Zope 3 is integrated at the zope package level Changed: A Zope/branches/jim-reintegrate-zope3/ -=- Copied: Zope/branches/jim-reintegrate-zope3 (from rev 39574, Zope/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/jim-reintegrate-zope3/lib/python/ Removed the zope external.
Log message for revision 39578: Removed the zope external. Changed: _U Zope/branches/jim-reintegrate-zope3/lib/python/ -=- Property changes on: Zope/branches/jim-reintegrate-zope3/lib/python ___ Name: svn:externals - zope svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/BTrees persistent svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/BTrees persistent svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/jim-reintegrate-zope3/lib/python/zope/ Added externals to the zope subpackages.
Log message for revision 39585: Added externals to the zope subpackages. Changed: _U Zope/branches/jim-reintegrate-zope3/lib/python/zope/ -=- Property changes on: Zope/branches/jim-reintegrate-zope3/lib/python/zope ___ Name: svn:externals + app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ Change to link to top-level Zope 3 top-level packages one-by-one.
Log message for revision 39599: Change to link to top-level Zope 3 top-level packages one-by-one. I have to do this in multiple steps because svn:externals is half baked. :( Changed: _U Zope/trunk/lib/python/ -=- Property changes on: Zope/trunk/lib/python ___ Name: svn:externals - zope svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/BTrees persistent svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/BTrees persistent svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.4.2/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/zope/ Change to link to top-level Zope 3 top-level packages one-by-one.
Log message for revision 39600: Change to link to top-level Zope 3 top-level packages one-by-one. Changed: A Zope/trunk/lib/python/zope/ _U Zope/trunk/lib/python/zope/__init__.py -=- Copied: Zope/trunk/lib/python/zope (from rev 39585, Zope/branches/jim-reintegrate-zope3/lib/python/zope) Property changes on: Zope/trunk/lib/python/zope ___ Name: svn:externals + app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales testing svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/testing thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/jim-mproxy/ Added Mild proxies. These are variations on Zope 3 security proxies
Log message for revision 38828: Added Mild proxies. These are variations on Zope 3 security proxies that, we hope, will backward compatible. Changed: A Zope/branches/jim-mproxy/lib/python/Zope2/security/ A Zope/branches/jim-mproxy/lib/python/Zope2/security/_Zope2_security_mproxy.c A Zope/branches/jim-mproxy/lib/python/Zope2/security/__init__.py A Zope/branches/jim-mproxy/lib/python/Zope2/security/mproxy.py A Zope/branches/jim-mproxy/lib/python/Zope2/security/mproxy.txt A Zope/branches/jim-mproxy/lib/python/Zope2/security/tests.py U Zope/branches/jim-mproxy/setup.py -=- Added: Zope/branches/jim-mproxy/lib/python/Zope2/security/_Zope2_security_mproxy.c === --- Zope/branches/jim-mproxy/lib/python/Zope2/security/_Zope2_security_mproxy.c 2005-10-06 20:23:16 UTC (rev 38827) +++ Zope/branches/jim-mproxy/lib/python/Zope2/security/_Zope2_security_mproxy.c 2005-10-06 20:32:26 UTC (rev 38828) @@ -0,0 +1,261 @@ +/* +* +* Copyright (c) 2003, 2004 Zope Corporation and Contributors. +* All Rights Reserved. +* +* This software is subject to the provisions of the Zope Public License, +* Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +* THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +* WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +* FOR A PARTICULAR PURPOSE. +* +** +Security Proxy Implementation + +$Id: _proxy.c 26705 2004-07-23 16:22:56Z jim $ +*/ + +#include Python.h + +static PyTypeObject *_Proxy = NULL; + +#define DECLARE_STRING(N) static PyObject *str_##N + +typedef struct { + PyObject_HEAD + PyObject *proxy_object; + PyObject *proxy_checker; +} MProxy; + +static PyObject * +mproxy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + static char *kwlist[] = {object, checker, 0}; + MProxy *self; + PyObject *object; + PyObject *checker; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, + OO:_Proxy.__new__, kwlist, + object, checker)) +return NULL; + + if (checker == Py_None) +{ + PyErr_SetString(PyExc_ValueError, None passed as proxy checker); + return NULL; +} + + self = (MProxy *)type-tp_alloc(type, 0); + if (self == NULL) +return NULL; + Py_INCREF(object); + Py_INCREF(checker); + self-proxy_object = object; + self-proxy_checker = checker; + return (PyObject *)self; +} + +static PyObject * +clean_args(MProxy *self, PyObject *args, int l) +{ + PyObject *result; + int i; + + result = PyTuple_New(l); + if (result == NULL) +return NULL; + + for (i=0; i l; i++) +{ + PyObject *o; + + o = PyTuple_GET_ITEM(args, i); + if (o != NULL) +{ + if (o-ob_type == self-ob_type) +o = ((MProxy *)o)-proxy_object; + Py_INCREF(o); +} + PyTuple_SET_ITEM(result, i, o); +} + + return result; +} + +static PyObject * +clean_kwds(MProxy *self, PyObject *kwds) +{ + PyObject *result; + PyObject *k, *o; + int pos = 0; + + result = PyDict_New(); + if (result == NULL) +return NULL; + + while (PyDict_Next(kwds, pos, k, o)) +{ + if (o-ob_type == self-ob_type) +o = ((MProxy *)o)-proxy_object; + if (PyDict_SetItem(result, k, o) 0) +{ + Py_DECREF(result); + return NULL; +} +} + + return result; +} + +static PyObject * +mproxy_call(MProxy *self, PyObject *args, PyObject *kwds) +{ + PyObject *result = NULL; + + if (args != NULL) +{ + int i, l; + + l = PyTuple_Size(args); + if (l 0) +return NULL; + + Py_INCREF(args); + for (i=0; i l; i++) +{ + PyObject *o; + + o = PyTuple_GET_ITEM(args, i); + if (o != NULL o-ob_type == self-ob_type) +{ + Py_DECREF(args); + args = clean_args(self, args, l); + break; +} +} +} + + if (kwds != NULL) +{ + PyObject *k, *o; + int pos = 0; + + Py_INCREF(kwds); + while (PyDict_Next(kwds, pos, k, o)) +{ + if (o-ob_type == self-ob_type) +{ + Py_DECREF(kwds); + kwds = clean_kwds(self, kwds); + break; +} +} +} + + result = _Proxy-tp_call((PyObject*)self, args, kwds); + Py_XDECREF(args); + Py_XDECREF(kwds); + + return result; +} + +static char proxy_doc[] = +Mild security proxies.\n +\n +See mproxy.txt.\n +; + +statichere PyTypeObject +MProxyType = { + PyObject_HEAD_INIT(NULL) + 0, + Zope2.security.mproxy.MProxy, + sizeof(MProxy), + 0, + 0, + 0, /* tp_print
[Zope-Checkins] SVN: Zope/trunk/lib/python/ZClasses/tests.py Reenabled the ZClass tests
Log message for revision 29937: Reenabled the ZClass tests Changed: U Zope/trunk/lib/python/ZClasses/tests.py -=- Modified: Zope/trunk/lib/python/ZClasses/tests.py === --- Zope/trunk/lib/python/ZClasses/tests.py 2005-04-10 13:03:18 UTC (rev 29936) +++ Zope/trunk/lib/python/ZClasses/tests.py 2005-04-10 13:03:20 UTC (rev 29937) @@ -44,131 +44,13 @@ transaction.abort() test.globs['db'].close() -# XXX Two tests are disable because they're failing on Zope trunk; -# XXX they didn't fail on Jim's branch: -# -# C:\Code\zt\python23\python.exe test.py ZClas -# Running unit tests from C:\Code\zt\lib\python -# == -# FAIL: Doctest: ZClass.txt -# -- -# Traceback (most recent call last): -# File C:\Code\zt\lib\python\zope\testing\doctest.py, line 2102, in runTest -# raise self.failureException(self.format_failure(new.getvalue())) -# AssertionError: Failed doctest test for ZClass.txt -# File C:\Code\zt\lib\python\ZClasses\ZClass.txt, line 0 -# -# -- -# File C:\Code\zt\lib\python\ZClasses\ZClass.txt, line 88, in ZClass.txt -# Failed example: -# print app2.c2.x, app2.c2.y, app2.c2.eek(), '!' -# Exception raised: -# Traceback (most recent call last): -# File C:\Code\zt\lib\python\zope\testing\doctest.py, line 1315, in __run -# compileflags, 1) in test.globs -# File doctest ZClass.txt[35], line 1, in ? -# print app2.c2.x, app2.c2.y, app2.c2.eek(), '!' -# File C:\Code\zt\lib\python\AccessControl\PermissionMapping.py, line 150, in __call__ -# return apply(self, args, kw) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 311, in __call__ -# return self._bindAndExec(args, kw, None) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 348, in _bindAndExec -# return self._exec(bound_data, args, kw) -# File C:\Code\zt\lib\python\Products\PythonScripts\PythonScript.py, line 323, in _exec -# result = f(*args, **kw) -# File Script (Python), line 1, in eek -# Unauthorized: You are not allowed to access 'x' in this context -# -- -# File C:\Code\zt\lib\python\ZClasses\ZClass.txt, line 110, in ZClass.txt -# Failed example: -# c3.eek() -# Exception raised: -# Traceback (most recent call last): -# File C:\Code\zt\lib\python\zope\testing\doctest.py, line 1315, in __run -# compileflags, 1) in test.globs -# File doctest ZClass.txt[42], line 1, in ? -# c3.eek() -# File C:\Code\zt\lib\python\AccessControl\PermissionMapping.py, line 150, in __call__ -# return apply(self, args, kw) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 311, in __call__ -# return self._bindAndExec(args, kw, None) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 348, in _bindAndExec -# return self._exec(bound_data, args, kw) -# File C:\Code\zt\lib\python\Products\PythonScripts\PythonScript.py, line 323, in _exec -# result = f(*args, **kw) -# File Script (Python), line 1, in eek -# Unauthorized: You are not allowed to access 'x' in this context -# -# -# == -# FAIL: Doctest: 27.txt -# -- -# Traceback (most recent call last): -# File C:\Code\zt\lib\python\zope\testing\doctest.py, line 2102, in runTest -# raise self.failureException(self.format_failure(new.getvalue())) -# AssertionError: Failed doctest test for 27.txt -# File C:\Code\zt\lib\python\ZClasses\27.txt, line 0 -# -# -- -# File C:\Code\zt\lib\python\ZClasses\27.txt, line 16, in 27.txt -# Failed example: -# ac.eek() -# Exception raised: -# Traceback (most recent call last): -# File C:\Code\zt\lib\python\zope\testing\doctest.py, line 1315, in __run -# compileflags, 1) in test.globs -# File doctest 27.txt[10], line 1, in ? -# ac.eek() -# File C:\Code\zt\lib\python\AccessControl\PermissionMapping.py, line 150, in __call__ -# return apply(self, args, kw) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 311, in __call__ -# return self._bindAndExec(args, kw, None) -# File C:\Code\zt\lib\python\Shared\DC\Scripts\Bindings.py, line 348, in _bindAndExec -# return self._exec(bound_data, args, kw) -# File C:\Code\zt\lib\python\Products\PythonScripts\PythonScript.py, line 323, in _exec -# result = f(*args, **kw) -# File Script (Python), line 1, in eek -#
[Zope-Checkins] SVN: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/_pmc.txt Added configuration of class factory.
Log message for revision 29868: Added configuration of class factory. Changed: U Zope/branches/jim-fix-zclasses/lib/python/ZClasses/_pmc.txt -=- Modified: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/_pmc.txt === --- Zope/branches/jim-fix-zclasses/lib/python/ZClasses/_pmc.txt 2005-04-04 11:03:48 UTC (rev 29867) +++ Zope/branches/jim-fix-zclasses/lib/python/ZClasses/_pmc.txt 2005-04-04 11:03:57 UTC (rev 29868) @@ -63,8 +63,13 @@ C._p_changed False -Now, we can store the class in a database: +Now, we can store the class in a database. We have to be careful, +however, to use the ZClass-aware class factory so that we can find +ZClasses, which are stored in the database, rather than in modules: + import Zope2.App.ClassFactory + some_database.classFactory = Zope2.App.ClassFactory.ClassFactory + connection = some_database.open() connection.root()['C'] = C import transaction ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/jim-fix-zclasses/lib/python/ZODB/ Added ZClass-independent test of (and possible base class for)
Log message for revision 29870: Added ZClass-independent test of (and possible base class for) persistent-class support machinery. Changed: A Zope/branches/jim-fix-zclasses/lib/python/ZODB/persistentclass.py A Zope/branches/jim-fix-zclasses/lib/python/ZODB/persistentclass.txt A Zope/branches/jim-fix-zclasses/lib/python/ZODB/tests/testpersistentclass.py -=- Added: Zope/branches/jim-fix-zclasses/lib/python/ZODB/persistentclass.py === --- Zope/branches/jim-fix-zclasses/lib/python/ZODB/persistentclass.py 2005-04-04 11:04:21 UTC (rev 29869) +++ Zope/branches/jim-fix-zclasses/lib/python/ZODB/persistentclass.py 2005-04-04 11:04:27 UTC (rev 29870) @@ -0,0 +1,224 @@ +## +# +# Copyright (c) 2004 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +## +Persistent Class Support + +$Id$ + + + +# Notes: +# +# Persistent classes are non-ghostable. This has some interesting +# ramifications: +# +# - When an object is invalidated, it must reload it's state +# +# - When an object is loaded from the database, it's state must be +# loaded. Unfortunately, there isn't a clear signal when an object is +# loaded from the database. This should probably be fixed. +# +# In the mean time, we need to infer. This should be viewed as a +# short term hack. +# +# Here's the strategy we'll use: +# +# - We'll have a need to be loaded flag that we'll set in +# __new__, through an extra argument. +# +# - When setting _p_oid and _p_jar, if both are set and we need to be +# loaded, then we'll load out state. +# +# - We'll use _p_changed is None to indicate that we're in this state. +# + +class _p_DataDescr(object): +# Descr used as base for _p_ data. Data are stored in +# _p_class_dict. + +def __init__(self, name): +self.__name__ = name + +def __get__(self, inst, cls): +if inst is None: +return self + +if '__global_persistent_class_not_stored_in_DB__' in inst.__dict__: +raise AttributeError, self.__name__ +return inst._p_class_dict.get(self.__name__) + +def __set__(self, inst, v): +inst._p_class_dict[self.__name__] = v + +def __delete__(self, inst): +raise AttributeError, self.__name__ + +class _p_oid_or_jar_Descr(_p_DataDescr): +# Special descr for _p_oid and _p_jar that loads +# state when set if both are set and and _p_changed is None +# +# See notes above + +def __set__(self, inst, v): +get = inst._p_class_dict.get +if v == get(self.__name__): +return + +inst._p_class_dict[self.__name__] = v + +jar = get('_p_jar') +if (jar is not None +and get('_p_oid') is not None +and get('_p_changed') is None +): +jar.setstate(inst) + +class _p_ChangedDescr(object): +# descriptor to handle special weird emantics of _p_changed + +def __get__(self, inst, cls): +if inst is None: +return self +return inst._p_class_dict['_p_changed'] + +def __set__(self, inst, v): +if v is None: +return +inst._p_class_dict['_p_changed'] = bool(v) + +def __delete__(self, inst): +inst._p_invalidate() + +class _p_MethodDescr(object): +Provide unassignable class attributes + + +def __init__(self, func): +self.func = func + +def __get__(self, inst, cls): +if inst is None: +return cls +return self.func.__get__(inst, cls) + +def __set__(self, inst, v): +raise AttributeError, self.__name__ + +def __delete__(self, inst): +raise AttributeError, self.__name__ + + +special_class_descrs = '__dict__', '__weakref__' + +class PersistentMetaClass(type): + +_p_jar = _p_oid_or_jar_Descr('_p_jar') +_p_oid = _p_oid_or_jar_Descr('_p_oid') +_p_changed = _p_ChangedDescr() +_p_serial = _p_DataDescr('_p_serial') + +def __new__(self, name, bases, cdict, _p_changed=False): +cdict = dict([(k, v) for (k, v) in cdict.items() + if not k.startswith('_p_')]) +cdict['_p_class_dict'] = {'_p_changed': _p_changed} +return super(PersistentMetaClass, self).__new__( +self, name, bases, cdict) + +def __getnewargs__(self): +return self.__name__,