--- a/lib/shorturl.py Wed Jan 16 14:58:03 2008 +0000
+++ b/lib/shorturl.py Wed Jan 16 16:28:00 2008 +0000
@@ -124,4 +124,22 @@
raise ValueError("%s is not an img" % key)
return dirpath, fname
+
+ def shorturls_for (self, paths) :
+ ret = []
+ for key in self.db.keys() :
+ if key.startswith('_') :
+ continue
+
+ type, dir, fname = self.db[key]
+ path = os.path.join(dir.lstrip('.').lstrip('/'), fname)
+ if path in paths :
+ ret.append(key)
+ paths.remove(path)
+
+ if paths :
+ raise ValueError("Paths not found: %s" % " ".join(paths))
+
+ return ret
+