예제 #1
0
파일: feeds.py 프로젝트: wangjun/openblock
 def get_object(self, bits):
     # TODO: This duplicates the logic in the URLconf. Fix Django to allow
     # for RSS feed URL parsing in the URLconf.
     # See http://code.djangoproject.com/ticket/4720
     if get_metro()['multiple_cities']:
         street_re = re.compile(r'^([-a-z]{3,40})/([-a-z0-9]{1,64})/%s$' % BLOCK_URL_REGEX)
     else:
         street_re = re.compile(r'^()([-a-z0-9]{1,64})/%s$' % BLOCK_URL_REGEX)
     m = street_re.search('/'.join(bits))
     if not m:
         raise Block.DoesNotExist
     city_slug, street_slug, from_num, to_num, predir, postdir = m.groups()
     return url_to_block(city_slug, street_slug, from_num, to_num, predir, postdir)
예제 #2
0
파일: feeds.py 프로젝트: frankk00/openblock
 def get_object(self, bits):
     # TODO: This duplicates the logic in the URLconf. Fix Django to allow
     # for RSS feed URL parsing in the URLconf.
     # See http://code.djangoproject.com/ticket/4720
     # XXX That bug is fixed, see http://docs.djangoproject.com/en/1.2/ref/contrib/syndication/#a-complex-example; we can replace the bits arg with a normal list of args from the url config, and ditch the regex.
     if get_metro()['multiple_cities']:
         street_re = re.compile(r'^([-a-z]{3,40})/([-a-z0-9]{1,64})/%s$' % BLOCK_URL_REGEX)
     else:
         street_re = re.compile(r'^()([-a-z0-9]{1,64})/%s$' % BLOCK_URL_REGEX)
     m = street_re.search('/'.join(bits))
     if not m:
         raise Block.DoesNotExist
     city_slug, street_slug, from_num, to_num, predir, postdir = m.groups()
     return url_to_block(city_slug, street_slug, from_num, to_num, predir, postdir)
예제 #3
0
 def get_object(self, bits):
     # TODO: This duplicates the logic in the URLconf. Fix Django to allow
     # for RSS feed URL parsing in the URLconf.
     # See http://code.djangoproject.com/ticket/4720
     if get_metro()['multiple_cities']:
         street_re = re.compile(r'^([-a-z]{3,40})/([-a-z0-9]{1,64})/%s$' %
                                BLOCK_URL_REGEX)
     else:
         street_re = re.compile(r'^()([-a-z0-9]{1,64})/%s$' %
                                BLOCK_URL_REGEX)
     m = street_re.search('/'.join(bits))
     if not m:
         raise Block.DoesNotExist
     city_slug, street_slug, from_num, to_num, predir, postdir = m.groups()
     return url_to_block(city_slug, street_slug, from_num, to_num, predir,
                         postdir)
예제 #4
0
파일: feeds.py 프로젝트: frankk00/openblock
 def get_object(self, bits):
     # TODO: This duplicates the logic in the URLconf. Fix Django to allow
     # for RSS feed URL parsing in the URLconf.
     # See http://code.djangoproject.com/ticket/4720
     # XXX That bug is fixed, see http://docs.djangoproject.com/en/1.2/ref/contrib/syndication/#a-complex-example; we can replace the bits arg with a normal list of args from the url config, and ditch the regex.
     if get_metro()['multiple_cities']:
         street_re = re.compile(r'^([-a-z]{3,40})/([-a-z0-9]{1,64})/%s$' %
                                BLOCK_URL_REGEX)
     else:
         street_re = re.compile(r'^()([-a-z0-9]{1,64})/%s$' %
                                BLOCK_URL_REGEX)
     m = street_re.search('/'.join(bits))
     if not m:
         raise Block.DoesNotExist
     city_slug, street_slug, from_num, to_num, predir, postdir = m.groups()
     return url_to_block(city_slug, street_slug, from_num, to_num, predir,
                         postdir)