projects
/
dbuscron
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b589c8
)
support \xXX escape characters in args field
author
Konstantin Stepanov
<kstep@p-nut.info>
Mon, 20 Dec 2010 19:31:20 +0000
(21:31 +0200)
committer
Konstantin Stepanov
<kstep@p-nut.info>
Mon, 20 Dec 2010 20:54:20 +0000
(22:54 +0200)
dbuscron/parser.py
patch
|
blob
|
history
diff --git
a/dbuscron/parser.py
b/dbuscron/parser.py
index
8184d75
..
8610f79
100644
(file)
--- a/
dbuscron/parser.py
+++ b/
dbuscron/parser.py
@@
-3,6
+3,13
@@
from __future__ import with_statement
import re
from dbuscron.bus import DbusBus
import re
from dbuscron.bus import DbusBus
+def unescape(value):
+ if not value or r'\x' not in value:
+ return value
+
+ r = re.compile(r'\\x([0-9A-Fa-f]{2})')
+ return r.sub(lambda m: chr(int(m.group(1), 16)), value)
+
def product(*args):
if args:
head, tail = args[0], args[1:]
def product(*args):
if args:
head, tail = args[0], args[1:]
@@
-96,7
+103,7
@@
class CrontabParser(object):
raise CrontabParserError('Unexpected bus value', lineno, expected=('S', 's', '*'))
if r[7]:
raise CrontabParserError('Unexpected bus value', lineno, expected=('S', 's', '*'))
if r[7]:
- r[7] = r[7].split(';')
+ r[7] = map(unescape, r[7].split(';'))
ruled = dict()
for i, f in enumerate(self.__fields):
ruled = dict()
for i, f in enumerate(self.__fields):