From ad4ed30dd62c0602184ed60ec428a1cabe0fe7fe Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 23 Apr 2011 01:34:01 +0200 Subject: [PATCH] get defaults to None --- pandora/api/views.py | 2 +- pandora/archive/models.py | 2 +- pandora/item/managers.py | 2 +- pandora/item/models.py | 12 ++++++------ pandora/item/views.py | 2 +- pandora/itemlist/managers.py | 2 +- pandora/place/managers.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pandora/api/views.py b/pandora/api/views.py index 89c7d178f..e66e64171 100644 --- a/pandora/api/views.py +++ b/pandora/api/views.py @@ -37,7 +37,7 @@ def api(request): #FIXME: possible to do this in f #data = json.loads(request.POST['data']) - f = actions.get(function, None) + f = actions.get(function) if f: response = f(request) else: diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 7cd67ea77..386f5b4fa 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -316,7 +316,7 @@ class File(models.Model): director = u'; '.join(director) director = re.sub(r'[:\\/]', '_', director) name = os.path.join(director, name) - year = self.item.get('year', None) + year = self.item.get('year') if year: name += u' (%s)' % year name = os.path.join(name[0].upper(), name) diff --git a/pandora/item/managers.py b/pandora/item/managers.py index 5ed6b0eb3..267d7024f 100644 --- a/pandora/item/managers.py +++ b/pandora/item/managers.py @@ -26,7 +26,7 @@ def parseCondition(condition): if not k: k = 'all' v = condition['value'] - op = condition.get('operator', None) + op = condition.get('operator') if not op: op = '' if op.startswith('!'): diff --git a/pandora/item/models.py b/pandora/item/models.py index 105ecc43d..fd75b7ffe 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -232,7 +232,7 @@ class Item(models.Model): if self.poster_frame == -1 and self.sort.duration: self.poster_frame = self.sort.duration/2 update_poster = True - if not self.get('runtime', None) and self.sort.duration: + if not self.get('runtime') and self.sort.duration: self.data['runtime'] = self.sort.duration self.update_sort() self.json = self.get_json() @@ -361,7 +361,7 @@ class Item(models.Model): def oxdb_id(self): if not settings.USE_IMDB: return self.itemId - if not self.get('title', None) and not self.get('director', None): + if not self.get('title') and not self.get('director'): return None return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')), self.get('season', ''), self.get('episode', ''), @@ -478,22 +478,22 @@ class Item(models.Model): set_value(s, name, value) elif sort_type in ('length', 'integer', 'float'): #can be length of strings or length of arrays, i.e. keywords - value = self.get(source, None) + value = self.get(source) if isinstance(value, list): value = len(value) set_value(s, name, value) elif sort_type == 'words': - value = self.get(source, None) + value = self.get(source) if isinstance(value, list): value = '\n'.join(value) if value: value = len(value.split(' ')) set_value(s, name, value) elif sort_type == 'year': - value = self.get(source, None) + value = self.get(source) set_value(s, name, value) elif sort_type == 'date': - value = self.get(source, None) + value = self.get(source) if isinstance(value, basestring): value = datetime.strptime(value, '%Y-%m-%d') set_value(s, name, value) diff --git a/pandora/item/views.py b/pandora/item/views.py index 66b796214..0b3dc6c20 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -528,7 +528,7 @@ def video(request, id, profile): path = stream.video.path content_type = path.endswith('.mp4') and 'video/mp4' or 'video/webm' #server side cutting - t = request.GET.get('t', None) + t = request.GET.get('t') if t: t = map(float, t.split(',')) ext = os.path.splitext(profile)[1] diff --git a/pandora/itemlist/managers.py b/pandora/itemlist/managers.py index 08961be38..d1b4c3cf3 100644 --- a/pandora/itemlist/managers.py +++ b/pandora/itemlist/managers.py @@ -28,7 +28,7 @@ def parseCondition(condition, user): if not k: k = 'name' v = condition['value'] - op = condition.get('operator', None) + op = condition.get('operator') if not op: op = '' if op.startswith('!'): diff --git a/pandora/place/managers.py b/pandora/place/managers.py index 2ee076797..70963a350 100644 --- a/pandora/place/managers.py +++ b/pandora/place/managers.py @@ -23,7 +23,7 @@ def parseCondition(condition, user): if not k: k = 'name' v = condition['value'] - op = condition.get('operator', None) + op = condition.get('operator') if not op: op = '' if op.startswith('!'):