aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'libpathod/utils.py')
-rw-r--r--libpathod/utils.py21
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: