[Checkins] SVN: zc.zk/trunk/s merge the "satchit-validate-script" branch:

satchit@zope.com cvs-admin at zope.org
Tue Sep 11 19:28:48 UTC 2012


Log message for revision 127821:
  merge the "satchit-validate-script" branch:
  
  svn merge -r 127819:HEAD $ZOPEORG/zc.zk/branches/satchit-validate-script .
  
  

Changed:
  U   zc.zk/trunk/setup.py
  U   zc.zk/trunk/src/zc/zk/scripts.py

-=-
Modified: zc.zk/trunk/setup.py
===================================================================
--- zc.zk/trunk/setup.py	2012-09-11 18:57:06 UTC (rev 127820)
+++ zc.zk/trunk/setup.py	2012-09-11 19:28:44 UTC (rev 127821)
@@ -24,6 +24,7 @@
 [console_scripts]
 zookeeper_export = zc.zk.scripts:export
 zookeeper_import = zc.zk.scripts:import_
+zookeeper_validate = zc.zk.scripts:validate_
 """
 
 from setuptools import setup

Modified: zc.zk/trunk/src/zc/zk/scripts.py
===================================================================
--- zc.zk/trunk/src/zc/zk/scripts.py	2012-09-11 18:57:06 UTC (rev 127820)
+++ zc.zk/trunk/src/zc/zk/scripts.py	2012-09-11 19:28:44 UTC (rev 127821)
@@ -98,3 +98,30 @@
         acl=[zc.zk.world_permission(options.permission)],
         )
 
+def validate_(args=None):
+    """Usage: %prog connection [file [path]]
+
+    Validate a tree definition from a file.
+
+    If no file is provided or if the import file is -, then
+    data are read from standard input.
+    """
+
+    if args is None:
+        args = sys.argv[1:]
+
+    parser = optparse.OptionParser(import_.__doc__)
+    options, args = parser.parse_args(args)
+    if len(args) != 1:
+        parser.parse_args(['-h'])
+    if args:
+        import_file = args.pop(0)
+    else:
+        import_file = '-'
+
+    if import_file == '-':
+        import_file = sys.stdin
+    else:
+        import_file = open(import_file)
+
+    zc.zk.parse_tree(import_file.read())



More information about the checkins mailing list