Permalink
Browse files

Merge branch 'master' of github.com:boto/boto

  • Loading branch information...
garnaat committed Feb 13, 2011
2 parents b198033 + aeba910 commit a3be562433e9222cdfb466165a7620db3debafda
Showing with 9 additions and 7 deletions.
  1. +5 −6 boto/sdb/db/model.py
  2. +4 −1 boto/sdb/db/property.py
View
@@ -95,10 +95,6 @@ def find(cls, limit=None, next_token=None, **params):
q.filter('%s =' % key, value)
return q
- @classmethod
- def lookup(cls, name, value):
- return cls._manager.lookup(cls, name, value)
-
@classmethod
def all(cls, limit=None, next_token=None):
return cls.find(limit=limit, next_token=next_token)
@@ -152,9 +148,12 @@ def from_xml(cls, fp):
def __init__(self, id=None, **kw):
self._loaded = False
- # first initialize all properties to their default values
+ # first try to initialize all properties to their default values
for prop in self.properties(hidden=False):
- setattr(self, prop.name, prop.default_value())
+ try:
+ setattr(self, prop.name, prop.default_value())
+ except ValueError:
+ pass
if kw.has_key('manager'):
self._manager = kw['manager']
self.id = id
View
@@ -378,7 +378,10 @@ def validate(self, value):
def get_value_for_datastore(self, model_instance):
if self.auto_now:
setattr(model_instance, self.name, self.now())
- return Property.get_value_for_datastore(self, model_instance)
+ val = Property.get_value_for_datastore(self, model_instance)
+ if isinstance(val, datetime.datetime):
+ val = val.date()
+ return val
def now(self):
return datetime.date.today()

0 comments on commit a3be562

Please sign in to comment.