git » galala » commit 13b564f

Don't add a new album if the shortname is already in use

author Rodrigo Campos
2013-12-13 00:46:55 UTC
committer Rodrigo Campos
2013-12-13 01:08:02 UTC
parent dbd4bad2961f4adcf130c4088b64369bcc82c434

Don't add a new album if the shortname is already in use

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>

galala +3 -0

diff --git a/galala b/galala
index 6e27fbf..b6a5a52 100755
--- a/galala
+++ b/galala
@@ -157,6 +157,9 @@ def add_albums(page):
         if not re.match("^[a-zA-Z0-9_-]+$", shortname):
             print "ERROR: shortname has invalid characters"
             continue
+        if find_album(page, shortname):
+            print "ERROR: shortname already in use (must be unique)"
+            continue
 
         title = raw_input("Album title: ").decode('utf8')
         text = raw_input("Album text: ").decode('utf8')