upgrade ox

This commit is contained in:
Sanj 2012-09-26 03:36:37 +05:30
parent 20da58746f
commit 97abd83974
3 changed files with 21 additions and 9 deletions

14
COPYING Normal file
View File

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2010 Sanjay Bhangar <sanjay@camputer.org>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,7 +1,5 @@
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.2.X/#egg=django
-e bzr+http://code.0xdb.org/python-oxdjango/#egg=python-oxdjango
-e bzr+http://code.0xdb.org/python-oxlib/#egg=python-oxlib
-e bzr+http://code.0xdb.org/python-oxweb/#egg=python-oxweb
ox
South
elementtree
django-extensions

View File

@ -1,12 +1,12 @@
from django.contrib.gis.db import models
import oxlib
import ox
import flickr
import settings
try:
import json
except:
import simplejson as json
from oxweb import youtube
from ox.web import youtube
flickr.API_KEY = settings.FLICKR_API_KEY
flickr.SECRET = settings.FLICKR_SECRET
@ -56,12 +56,12 @@ class Image(models.Model):
#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)
id = ox.find_re(self.url, regex)
if id != '':
return id
else:
regex = r'http://.*?/.*?/.*?/(.*?)/in/.*'
return oxlib.findRe(self.url, regex)
return ox.find_re(self.url, regex)
def __unicode__(self):
return self.url + " - " + self.caption
@ -159,10 +159,10 @@ class YoutubeVideo(models.Model):
def get_youtube_id(self):
reg = r'http.*?v=(.*?)$'
id = oxlib.findRe(self.url, reg)
id = ox.find_re(self.url, reg)
if id == '':
reg = r'http://.*?/user/.*?/u/.*?/(.*?)$'
id = oxlib.findRe(self.url, reg)
id = ox.find_re(self.url, reg)
return id
def get_dict(self):