Permalink
Browse files

Merge branch 'master' of github.com:mhluongo/neo4django

  • Loading branch information...
2 parents 9d4b0d6 + c109bac commit eefdf6a122fdbe26c62b6563f9ff6b30a4de2f93 @mhluongo mhluongo committed Oct 18, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 neo4django/db/models/properties.py
@@ -534,7 +534,7 @@ def next_value_gremlin(self):
class DateProperty(Property):
__format = '%Y-%m-%d'
- ansi_date_re = re.compile(r'^\d{4}-\d{1,2}-\d{1,2}$')
+ ansi_date_re = r'^\d{4}-\d{1,2}-\d{1,2}$'
default_error_messages = {
'invalid': _('Enter a valid date in YYYY-MM-DD format.'),
@@ -556,7 +556,7 @@ def __init__(self, auto_now=False, auto_now_add=False, **kwargs):
@classmethod
def __parse_date_string(cls, value):
- if not cls.ansi_date_re.search(value):
+ if not re.search(cls.ansi_date_re, value):
raise exceptions.ValidationError(cls.default_error_messages['invalid'])
# Now that we have the date string in YYYY-MM-DD format, check to make
# sure it's a valid date.
@@ -823,8 +823,7 @@ def __init__(self, *args, **kwargs):
self.use_string = kwargs.get("use_string", False)
self.token = kwargs.get("token", ",")
self.escape_token = kwargs.get("escape_token", "+")
- self.token_regex = re.compile(
- "(?<!%s)%s" % (re.escape(self.escape_token), self.token))
+ self.token_regex = "(?<!%s)%s" % (re.escape(self.escape_token), self.token)
def get_default(self):
if self.use_string:
@@ -834,7 +833,7 @@ def get_default(self):
def from_neo(self, value):
if value and not isinstance(value, (tuple, list)) and self.use_string:
- array_values = self.token_regex.split(value)
+ array_values = re.split(self.token_regex, value)
for i, v in enumerate(array_values):
array_values[i] = v.replace(
"%s%s" % (self.escape_token, self.token), self.token)

0 comments on commit eefdf6a

Please sign in to comment.