Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed Python 2.4 incompatibility. Resolves issue 40.

git-svn-id: http://django-modeltranslation.googlecode.com/svn/trunk@80 eb01185e-fd33-11dd-bc25-5f29055a2a2d
  • Loading branch information...
commit 00fbdd61182eae006726929c806f4759e00dbbf6 1 parent b4c36fc
@deschler deschler authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 modeltranslation/fields.py
View
10 modeltranslation/fields.py
@@ -216,10 +216,12 @@ def __get__(self, instance, owner):
loc_field_name = build_localized_fieldname(self.name,
get_language())
if hasattr(instance, loc_field_name):
- return getattr(instance, loc_field_name) or\
- (self.get_default_instance(instance) if\
- self.fallback_value is None else\
- self.fallback_value)
+ if getattr(instance, loc_field_name):
+ return getattr(instance, loc_field_name)
+ elif self.fallback_value is None:
+ return self.get_default_instance(instance)
+ else:
+ return self.fallback_value
def get_default_instance(self, instance):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.