really ugly regex
This commit is contained in:
parent
00fef249ed
commit
aae49b90d4
|
@ -52,8 +52,15 @@ class Image(models.Model):
|
||||||
location = models.ForeignKey(Location)
|
location = models.ForeignKey(Location)
|
||||||
flickrData = models.TextField(blank=True, editable=False)
|
flickrData = models.TextField(blank=True, editable=False)
|
||||||
|
|
||||||
|
|
||||||
|
#this function is fucked. either just get user to enter flickr id, or write a recursive function with an array of regexps and pray. but this is just crap.
|
||||||
def get_flickr_id(self):
|
def get_flickr_id(self):
|
||||||
regex = r'http\:\/\/.*?\/\d{4}/(.*?)_.*'
|
regex = r'http\:\/\/.*?\/\d{4}/(.*?)_.*'
|
||||||
|
id = oxlib.findRe(self.url, regex)
|
||||||
|
if id != '':
|
||||||
|
return id
|
||||||
|
else:
|
||||||
|
regex = r'http://.*?/.*?/.*?/(.*?)/in/.*'
|
||||||
return oxlib.findRe(self.url, regex)
|
return oxlib.findRe(self.url, regex)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user