From aae49b90d45be3fe01a87cae3b58dca194f12528 Mon Sep 17 00:00:00 2001 From: sanj Date: Tue, 26 Oct 2010 01:14:35 +0200 Subject: [PATCH] really ugly regex --- rizk/egypt/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rizk/egypt/models.py b/rizk/egypt/models.py index 0eedb71..56dd5d8 100644 --- a/rizk/egypt/models.py +++ b/rizk/egypt/models.py @@ -52,8 +52,15 @@ class Image(models.Model): location = models.ForeignKey(Location) 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): 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) def __unicode__(self):