equal
deleted
inserted
replaced
122 |
122 |
123 if type != 'img' : |
123 if type != 'img' : |
124 raise ValueError("%s is not an img" % key) |
124 raise ValueError("%s is not an img" % key) |
125 |
125 |
126 return dirpath, fname |
126 return dirpath, fname |
|
127 |
|
128 def shorturls_for (self, paths) : |
|
129 ret = [] |
127 |
130 |
|
131 for key in self.db.keys() : |
|
132 if key.startswith('_') : |
|
133 continue |
|
134 |
|
135 type, dir, fname = self.db[key] |
|
136 path = os.path.join(dir.lstrip('.').lstrip('/'), fname) |
|
137 if path in paths : |
|
138 ret.append(key) |
|
139 paths.remove(path) |
|
140 |
|
141 if paths : |
|
142 raise ValueError("Paths not found: %s" % " ".join(paths)) |
|
143 |
|
144 return ret |
|
145 |