msmith - in flumotion/trunk: . flumotion/admin/command

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Wed May 9 12:22:24 CEST 2007


Author: msmith
Date: Wed May  9 12:22:21 2007
New Revision: 4901

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/admin/command/commands.py
Log:
        * flumotion/admin/command/commands.py:
          Allow flumotion-command invoke arguments to include the contents of
          a file as a string argument using the 'F' format character.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Wed May  9 12:22:21 2007
@@ -1,5 +1,11 @@
 2007-05-09  Michael Smith <msmith at fluendo.com>
 
+	* flumotion/admin/command/commands.py:
+	  Allow flumotion-command invoke arguments to include the contents of
+	  a file as a string argument using the 'F' format character.
+
+2007-05-09  Michael Smith <msmith at fluendo.com>
+
 	* flumotion/component/producers/playlist/playlist.py:
 	  Fix remote method to use proper variable.
 	  

Modified: flumotion/trunk/flumotion/admin/command/commands.py
==============================================================================
--- flumotion/trunk/flumotion/admin/command/commands.py	(original)
+++ flumotion/trunk/flumotion/admin/command/commands.py	Wed May  9 12:22:21 2007
@@ -169,11 +169,21 @@
     pass
 
 def _parse_typed_args(spec, args):
+    def _readFile(filename):
+        try:
+            f = open(filename)
+            contents = f.read()
+            f.close()
+            return contents
+        except:
+            raise ParseException("Failed to read file %s" % (filename,))
+            
     def _do_parse_typed_args(spec, args):
         accum = []
         while spec:
             argtype = spec.pop(0)
-            parsers = {'i': int, 's': str, 'b': common.strToBool}
+            parsers = {'i': int, 's': str, 'b': common.strToBool, 
+                'F': _readFile}
             if argtype == ')':
                 return tuple(accum)
             elif argtype == '(':


More information about the flumotion-commit mailing list