Index: trunk/extensions/SwiftMedia/wmf/rewrite.py |
— | — | @@ -173,6 +173,15 @@ |
174 | 174 | # keep a copy of the original request so we can ask the scalers for it |
175 | 175 | reqorig = req.copy() |
176 | 176 | |
| 177 | + # Containers have 4 components: project, language, zone, and shard. |
| 178 | + # Shard is optional (and configurable). If there's no zone in the URL, |
| 179 | + # the zone is 'public'. Project, language, and zone are turned into containers |
| 180 | + # with the pattern proj-lang-local-zone (or proj-lang-local-zone.shard). |
| 181 | + # Projects are wikipedia, wikinews, etc. |
| 182 | + # Languages are en, de, fr, commons, etc. |
| 183 | + # Zones are public, thumb, and temp. |
| 184 | + # Shards are stolen from the URL and are 2 digits of hex. |
| 185 | + # Examples: |
177 | 186 | # Rewrite URLs of these forms (source, temp, and thumbnail files): |
178 | 187 | # (a) http://upload.wikimedia.org/<proj>/<lang>/.* |
179 | 188 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/.* |
— | — | @@ -187,7 +196,7 @@ |
188 | 197 | match = re.match(r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>(archive/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$', req.path) |
189 | 198 | if match: |
190 | 199 | # Get the repo zone (if not provided that means "public") |
191 | | - zone = match.group('zone') if match.group('zone') else 'public' |
| 200 | + zone = (match.group('zone') if match.group('zone') else 'public') |
192 | 201 | # Get the object path relative to the zone (and thus container) |
193 | 202 | obj = match.group('path') # e.g. "archive/a/ab/..." |
194 | 203 | |