[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/ also create rundirectory/socketdirectory when configured from config file

2009-01-29 Thread Christian Zagrodnick
Log message for revision 95380:
  also create rundirectory/socketdirectory when configured from config file
  

Changed:
  U   zdaemon/trunk/src/zdaemon/component.xml
  U   zdaemon/trunk/src/zdaemon/tests/testzdrun.py
  U   zdaemon/trunk/src/zdaemon/zdoptions.py

-=-
Modified: zdaemon/trunk/src/zdaemon/component.xml
===
--- zdaemon/trunk/src/zdaemon/component.xml 2009-01-29 08:09:28 UTC (rev 
95379)
+++ zdaemon/trunk/src/zdaemon/component.xml 2009-01-29 08:32:15 UTC (rev 
95380)
@@ -78,7 +78,8 @@
   /description
 /key
 
-key name=socket-name datatype=existing-dirpath
+key name=socket-name
+ datatype=zdaemon.zdoptions.existing_parent_dirpath
  required=no
  default=zdsock
   description
@@ -113,7 +114,8 @@
   /description
 /key
 
-key name=directory datatype=existing-directory
+key name=directory
+ datatype=zdaemon.zdoptions.existing_parent_directory
  required=no
   description
 Command-line option: -z or --directory.

Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py2009-01-29 08:09:28 UTC 
(rev 95379)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py2009-01-29 08:32:15 UTC 
(rev 95380)
@@ -319,6 +319,9 @@
 sys.stdout = StringIO()
 sys.stderr = StringIO()
 self.expect = ''
+self.cmd = /bin/true
+if not os.path.exists(self.cmd):
+self.cmd = /usr/bin/true  # Mac OS X
 
 def tearDown(self):
 shutil.rmtree(self.root)
@@ -332,23 +335,30 @@
 super(TestRunnerDirectory, self).tearDown()
 
 def run_ctl(self, opts):
-true_cmd = /bin/true
-if not os.path.exists(true_cmd):
-true_cmd = /usr/bin/true  # Mac OS X
 options = zdctl.ZDCtlOptions()
-options.realize(opts + ['-p', 'sleep 1', 'fg'])
-self.expect = 'sleep 1\n'
+options.realize(opts + ['fg'])
+self.expect = self.cmd + '\n'
 proc = zdctl.ZDCmd(options)
 proc.onecmd( .join(options.args))
 
 def testCtlRunDirectoryCreation(self):
 path = os.path.join(self.root, 'rundir')
-self.run_ctl(['-z', path])
+self.run_ctl(['-z', path, '-p', self.cmd])
 self.assert_(os.path.exists(path))
 
+def testCtlRunDirectoryCreationFromConfigFile(self):
+path = os.path.join(self.root, 'rundir')
+options = ['directory ' + path,
+   'program ' + self.cmd]
+config = self.writeConfig(
+'runner\n%s\n/runner' % '\n'.join(options))
+self.run_ctl(['-C', config])
+self.assert_(os.path.exists(path))
+
 def testCtlRunDirectoryCreationOnlyOne(self):
 path = os.path.join(self.root, 'rundir', 'not-created')
-self.assertRaises(SystemExit, self.run_ctl, ['-z', path])
+self.assertRaises(SystemExit,
+  self.run_ctl, ['-z', path, '-p', self.cmd])
 self.assertFalse(os.path.exists(path))
 got = sys.stderr.getvalue().strip()
 sys.stderr = StringIO()
@@ -356,19 +366,33 @@
 
 def testCtlSocketDirectoryCreation(self):
 path = os.path.join(self.root, 'rundir', 'sock')
-self.run_ctl(['-s', path])
+self.run_ctl(['-s', path, '-p', self.cmd])
 self.assert_(os.path.exists(os.path.dirname(path)))
 
-
 def testCtlSocketDirectoryCreationOnlyOne(self):
 path = os.path.join(self.root, 'rundir', 'not-created', 'sock')
-self.assertRaises(SystemExit, self.run_ctl, ['-s', path])
+self.assertRaises(SystemExit,
+  self.run_ctl, ['-s', path, '-p', self.cmd])
 self.assertFalse(os.path.exists(path))
 got = sys.stderr.getvalue().strip()
 sys.stderr = StringIO()
 self.assertTrue(got.startswith('Error: invalid value for -s'))
 
+def testCtlSocketDirectoryCreationFromConfigFile(self):
+path = os.path.join(self.root, 'rundir')
+options = ['socket-name %s/sock' % path,
+   'program ' + self.cmd]
+config = self.writeConfig(
+'runner\n%s\n/runner' % '\n'.join(options))
+self.run_ctl(['-C', config])
+self.assert_(os.path.exists(path))
 
+def writeConfig(self, config):
+config_file = os.path.join(self.root, 'config')
+open(config_file, 'w').write(config)
+return config_file
+
+
 def send_action(action, sockname):
 Send an action to the zdrun server and return the response.
 

Modified: zdaemon/trunk/src/zdaemon/zdoptions.py
===
--- zdaemon/trunk/src/zdaemon/zdoptions.py  2009-01-29 08:09:28 UTC (rev 
95379)
+++ zdaemon/trunk/src/zdaemon/zdoptions.py  2009-01-29 08:32:15 UTC (rev 
95380)
@@ -403,6 +403,9 @@
 
 def 

[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/ fix directory chown and add a test

2009-01-29 Thread Christian Zagrodnick
Log message for revision 95384:
  fix directory chown and add a test
  

Changed:
  U   zdaemon/trunk/src/zdaemon/tests/testzdrun.py
  U   zdaemon/trunk/src/zdaemon/zdctl.py

-=-
Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py2009-01-29 08:35:16 UTC 
(rev 95383)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py2009-01-29 08:43:30 UTC 
(rev 95384)
@@ -392,7 +392,31 @@
 open(config_file, 'w').write(config)
 return config_file
 
+def testDirectoryChown(self):
+path = os.path.join(self.root, 'foodir')
+options = zdctl.ZDCtlOptions()
+options.realize(['-p', self.cmd])
+cmd = zdctl.ZDCmd(options)
+options.uid = 27
+options.gid = 28
+# Patch chown and geteuid, because we're not root
+chown = os.chown
+geteuid = os.geteuid
+calls = []
+def my_chown(*args):
+calls.append(('chown',) + args)
+def my_geteuid():
+return 0
+try:
+os.chown = my_chown
+os.geteuid = my_geteuid
+cmd.create_directory(path)
+finally:
+os.chown = chown
+os.geteuid = geteuid
+self.assertEqual([('chown', path, 27, 28)], calls)
 
+
 def send_action(action, sockname):
 Send an action to the zdrun server and return the response.
 

Modified: zdaemon/trunk/src/zdaemon/zdctl.py
===
--- zdaemon/trunk/src/zdaemon/zdctl.py  2009-01-29 08:35:16 UTC (rev 95383)
+++ zdaemon/trunk/src/zdaemon/zdctl.py  2009-01-29 08:43:30 UTC (rev 95384)
@@ -167,7 +167,7 @@
 uid = os.geteuid()
 if uid == 0 and uid != self.options.uid:
 # Change owner of directory to target
-os.chown(self.options.uid, self.options.gid)
+os.chown(directory, self.options.uid, self.options.gid)
 
 def set_uid(self):
 if self.options.uid is None:

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py Merged trunk r95406 into 2.10 branch.

2009-01-29 Thread Stefan H. Holek
Log message for revision 95427:
  Merged trunk r95406 into 2.10 branch.
  
  Use a layer to load the CA (we need the container handlers).
  

Changed:
  U   Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py

-=-
Modified: Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py
===
--- Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py 
2009-01-29 13:08:34 UTC (rev 95426)
+++ Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py 
2009-01-29 13:13:50 UTC (rev 95427)
@@ -5,6 +5,9 @@
 
 import transaction
 
+from zope.testing import cleanup
+from Products.Five import zcml
+
 from Testing.makerequest import makerequest
 
 from AccessControl.SecurityManagement import newSecurityManager
@@ -55,12 +58,27 @@
 
 
 from Products.Five.eventconfigure import setDeprecatedManageAddDelete
-setDeprecatedManageAddDelete(TestItem)
-setDeprecatedManageAddDelete(TestFolder)
 
+class HookLayer:
 
+@classmethod
+def setUp(cls):
+cleanup.cleanUp()
+zcml._initialized = 0
+zcml.load_site()
+setDeprecatedManageAddDelete(TestItem)
+setDeprecatedManageAddDelete(TestFolder)
+
+@classmethod
+def tearDown(cls):
+cleanup.cleanUp()
+zcml._initialized = 0
+
+
 class HookTest(unittest.TestCase):
 
+layer = HookLayer
+
 def setUp(self):
 self.app = makerequest(Zope2.app())
 try:

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.11/lib/python/OFS/tests/testCopySupportHooks.py Merged trunk r95406 into 2.11 branch.

2009-01-29 Thread Stefan H. Holek
Log message for revision 95426:
  Merged trunk r95406 into 2.11 branch.
  
  Use a layer to load the CA (we need the container handlers).
  

Changed:
  U   Zope/branches/2.11/lib/python/OFS/tests/testCopySupportHooks.py

-=-
Modified: Zope/branches/2.11/lib/python/OFS/tests/testCopySupportHooks.py
===
--- Zope/branches/2.11/lib/python/OFS/tests/testCopySupportHooks.py 
2009-01-29 12:43:33 UTC (rev 95425)
+++ Zope/branches/2.11/lib/python/OFS/tests/testCopySupportHooks.py 
2009-01-29 13:08:34 UTC (rev 95426)
@@ -5,6 +5,9 @@
 
 import transaction
 
+from zope.testing import cleanup
+from Products.Five import zcml
+
 from Testing.makerequest import makerequest
 
 from AccessControl.SecurityManagement import newSecurityManager
@@ -55,12 +58,27 @@
 
 
 from Products.Five.eventconfigure import setDeprecatedManageAddDelete
-setDeprecatedManageAddDelete(TestItem)
-setDeprecatedManageAddDelete(TestFolder)
 
+class HookLayer:
 
+@classmethod
+def setUp(cls):
+cleanup.cleanUp()
+zcml._initialized = 0
+zcml.load_site()
+setDeprecatedManageAddDelete(TestItem)
+setDeprecatedManageAddDelete(TestFolder)
+
+@classmethod
+def tearDown(cls):
+cleanup.cleanUp()
+zcml._initialized = 0
+
+
 class HookTest(unittest.TestCase):
 
+layer = HookLayer
+
 def setUp(self):
 self.app = makerequest(Zope2.app())
 try:

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt Not yet.

2009-01-29 Thread Stefan H. Holek
Log message for revision 95428:
  Not yet.

Changed:
  U   Zope/trunk/doc/CHANGES.txt

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2009-01-29 13:13:50 UTC (rev 95427)
+++ Zope/trunk/doc/CHANGES.txt  2009-01-29 13:16:22 UTC (rev 95428)
@@ -9,8 +9,6 @@
 
 Restructuring
 
-  - Using ZODB 3.9
-
   - Disabled the XML export on the UI level - the export functionality
 however is still available on the Python level.
 

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins