commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r6765 - trunk/gnue-common/src/formatting


From: jcater
Subject: r6765 - trunk/gnue-common/src/formatting
Date: Tue, 30 Nov 2004 21:36:10 -0600 (CST)

Author: jcater
Date: 2004-11-30 21:36:09 -0600 (Tue, 30 Nov 2004)
New Revision: 6765

Modified:
   trunk/gnue-common/src/formatting/GTypecast.py
Log:
added an 'escaped' typecast function

Modified: trunk/gnue-common/src/formatting/GTypecast.py
===================================================================
--- trunk/gnue-common/src/formatting/GTypecast.py       2004-12-01 00:34:26 UTC 
(rev 6764)
+++ trunk/gnue-common/src/formatting/GTypecast.py       2004-12-01 03:36:09 UTC 
(rev 6765)
@@ -169,3 +169,21 @@
     raise TypecastError
 
 
+#######################################################
+#
+# escaped
+#
+# This "unescapes" a string
+# e.g., escape ("\\x40") --> '@'
+#
+#######################################################
+def escaped (value):
+  
+  # There should be a python built-in for this :(
+  try:
+    print '(%s)' % value
+    v = '"%s "' % value.replace('"','\\"')
+    print '(%s)' % v
+    return eval(v)[:-1]
+  except ValueError, msg:
+    raise TypecastError, msg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]