(Steve Dougherty)
2013-11-10: Support trailing slash after an edition number. tip Support trailing slash after an edition number. A trailing slash on a repo path would abort with an uninformative "cannot parse" error.
diff --git a/infocalypse/devnotes.txt b/infocalypse/devnotes.txt
--- a/infocalypse/devnotes.txt
+++ b/infocalypse/devnotes.txt
@@ -10,7 +10,13 @@ WoT identifier -
Often abbreviated "wot_id". Not to be confused with a WoT
identity.
WoT identity ID -
- name given to the public key hash when returned by WoT.
+ a WoT identity's public key hash.
+
+------------------------------------------------------------
+Architecture:
+------------------------------------------------------------
+
+
------------------------------------------------------------
Dev log:
diff --git a/infocalypse/keys.py b/infocalypse/keys.py
--- a/infocalypse/keys.py
+++ b/infocalypse/keys.py
@@ -69,6 +69,10 @@ def parse_repo_path(path, assume_redunda
'USK@.../name/0'
>>> parse_repo_path('USK@.../name/')
'USK@.../name/0'
+ >>> parse_repo_path('USK@.../name/10')
+ 'USK@.../name/10'
+ >>> parse_repo_path('USK@.../name/10/')
+ 'USK@.../name/10'
>>> parse_repo_path('USK@.../name', assume_redundancy=True)
'USK@.../name.R1/0'
>>> parse_repo_path('USK@.../name.R0/5', assume_redundancy=True)
@@ -84,6 +88,13 @@ def parse_repo_path(path, assume_redunda
# Assuming USK@..,/name: '/edition' omitted.
parts.append('0')
+ if len(parts) == 4:
+ # Assuming trailing slash - the part after it should be empty.
+ if parts[3]:
+ raise util.Abort("Found unexpected '{0}' trailing the edition "
+ "number.".format(parts[3]))
+ parts.pop()
+
if not len(parts) == 3:
raise util.Abort("Cannot parse '{0}' as repository path.".format(path))