diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-24 16:38:32 +1200 |
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-24 16:38:32 +1200 |
| commit | 4fc64ac04ffbec8e3a51ea3f7a129f17530ee3ef (patch) | |
| tree | 377ad164d9bb860ddba4fc1b1134828f38feebed /libpathod/utils.py | |
| parent | e6aa9ff67582c00d2de03f65b47dd776cd602fb7 (diff) | |
| download | mitmproxy-4fc64ac04ffbec8e3a51ea3f7a129f17530ee3ef.tar.gz mitmproxy-4fc64ac04ffbec8e3a51ea3f7a129f17530ee3ef.tar.bz2 mitmproxy-4fc64ac04ffbec8e3a51ea3f7a129f17530ee3ef.zip | |
Enable anchors on command line.
Diffstat (limited to 'libpathod/utils.py')
| -rw-r--r-- | libpathod/utils.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/libpathod/utils.py b/libpathod/utils.py index f421b8a6..39732849 100644 --- a/libpathod/utils.py +++ b/libpathod/utils.py @@ -1,27 +1,14 @@ import os, re import rparse -class AnchorError(Exception): pass - -def parse_anchor_spec(s, settings): +def parse_anchor_spec(s): """ - For now, this is very simple, and you can't have an '=' in your regular - expression. + Return a tuple, or None on error. """ if not "=" in s: - raise AnchorError("Invalid anchor definition: %s"%s) - rex, spec = s.split("=", 1) - try: - re.compile(rex) - except re.error: - raise AnchorError("Invalid regex in anchor: %s"%s) - try: - rparse.parse(settings, spec) - except rparse.ParseException, v: - raise AnchorError("Invalid page spec in anchor: '%s', %s"%(s, str(v))) - - return rex, spec + return None + return tuple(s.split("=", 1)) class Data: |
