Skip to content

Commit

Permalink
Merge pull request #22 from pkit/minor_fixes
Browse files Browse the repository at this point in the history
moved static macros definition from func to module
  • Loading branch information
Constantine Peresypkin committed Mar 25, 2014
2 parents f0ebfa3 + fa6a2cc commit 889eaae
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions zerocloud/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
REPORT_CDR = 4
REPORT_STATUS = 5

RE_ILLEGAL = u'([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])' + \
u'|' + \
u'([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])' % \
(unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),)


def merge_headers(current, new):
if hasattr(new, 'keys'):
Expand All @@ -113,12 +120,6 @@ def merge_headers(current, new):

def has_control_chars(line):
if line:
RE_ILLEGAL = u'([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])' + \
u'|' + \
u'([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])' % \
(unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),)
if re.search(RE_ILLEGAL, line):
return True
if re.search(r"[\x01-\x1F\x7F]", line):
Expand Down

0 comments on commit 889eaae

Please sign in to comment.