r108699 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108698‎ | r108699 | r108700 >
Date:23:49, 11 January 2012
Author:ben
Status:ok
Tags:
Comment:
added more comments describing containers and added parentheses to clarify conditional assignment. FU r108596
Modified paths:
  • /trunk/extensions/SwiftMedia/wmf/rewrite.py (modified) (history)

Diff [purge]

Index: trunk/extensions/SwiftMedia/wmf/rewrite.py
@@ -173,6 +173,15 @@
174174 # keep a copy of the original request so we can ask the scalers for it
175175 reqorig = req.copy()
176176
 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:
177186 # Rewrite URLs of these forms (source, temp, and thumbnail files):
178187 # (a) http://upload.wikimedia.org/<proj>/<lang>/.*
179188 # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/.*
@@ -187,7 +196,7 @@
188197 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)
189198 if match:
190199 # 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')
192201 # Get the object path relative to the zone (and thus container)
193202 obj = match.group('path') # e.g. "archive/a/ab/..."
194203

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108596* Keep the hash paths in the container paths for simplicity....aaron03:32, 11 January 2012

Status & tagging log