Last change
on this file since 1413 was
1393,
checked in by piv, 15 years ago
|
override Marshall namespaces to handle Control Characters properly
|
File size:
471 bytes
|
Rev | Line | |
---|
[1393] | 1 | """ |
---|
| 2 | Helpful functions for namespaces |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | import re |
---|
| 6 | |
---|
| 7 | # control characters from 0-31 and 127 (delete) excluding: |
---|
| 8 | # 9 (\t, tab) |
---|
| 9 | # 10 (\n, new line character) |
---|
| 10 | # 13 (\r, carriage return) |
---|
| 11 | # 127 (\x1f, delete) |
---|
| 12 | # which are handled properly by python xml libraries such |
---|
| 13 | # as xml.dom.minidom and elementtree |
---|
| 14 | _ctrl_chars = re.compile(r'[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]') |
---|
| 15 | def has_ctrlchars(value): |
---|
| 16 | if _ctrl_chars.search(value): |
---|
| 17 | return True |
---|
| 18 | return False |
---|
Note: See
TracBrowser
for help on using the repository browser.