From 4fc64ac04ffbec8e3a51ea3f7a129f17530ee3ef Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 24 Jun 2012 16:38:32 +1200 Subject: Enable anchors on command line. --- libpathod/utils.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'libpathod/utils.py') 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: -- cgit v1.2.3