Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Unified Diff: third_party/gsutil/boto/boto/sdb/db/property.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gsutil/boto/boto/sdb/db/model.py ('k') | third_party/gsutil/boto/boto/sdb/db/query.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/boto/boto/sdb/db/property.py
diff --git a/third_party/gsutil/20110627/boto/boto/sdb/db/property.py b/third_party/gsutil/boto/boto/sdb/db/property.py
similarity index 98%
rename from third_party/gsutil/20110627/boto/boto/sdb/db/property.py
rename to third_party/gsutil/boto/boto/sdb/db/property.py
index 1929a02722640f4f18ef32f1a85d2992d966ec2c..1387be9d4e5d8383d8ace54ca1ca7971d8b5f467 100644
--- a/third_party/gsutil/20110627/boto/boto/sdb/db/property.py
+++ b/third_party/gsutil/boto/boto/sdb/db/property.py
@@ -78,7 +78,7 @@ class Property(object):
if isinstance(value, basestring) or value == self.default_value():
return
if not isinstance(value, self.data_type):
- raise TypeError, 'Validation Error, expecting %s, got %s' % (self.data_type, type(value))
+ raise TypeError, 'Validation Error, %s.%s expecting %s, got %s' % (self.model_class.__name__, self.name, self.data_type, type(value))
def default_value(self):
return self.default
@@ -375,6 +375,9 @@ class FloatProperty(Property):
return value is None
class DateTimeProperty(Property):
+ """This class handles both the datetime.datetime object
+ And the datetime.date objects. It can return either one,
+ depending on the value stored in the database"""
data_type = datetime.datetime
type_name = 'DateTime'
@@ -391,11 +394,11 @@ class DateTimeProperty(Property):
return Property.default_value(self)
def validate(self, value):
- value = super(DateTimeProperty, self).validate(value)
if value == None:
return
- if not isinstance(value, self.data_type):
- raise TypeError, 'Validation Error, expecting %s, got %s' % (self.data_type, type(value))
+ if isinstance(value, datetime.date):
+ return value
+ return super(DateTimeProperty, self).validate(value)
def get_value_for_datastore(self, model_instance):
if self.auto_now:
« no previous file with comments | « third_party/gsutil/boto/boto/sdb/db/model.py ('k') | third_party/gsutil/boto/boto/sdb/db/query.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698