Anonymous avatar Anonymous committed 084b90b

address PR comments, fix potential bug in defaults loading

Comments (0)

Files changed (2)

docs/api/model.rst

 :ref:`defaults are provided <using-default-values>`, all fields are set to ``None``
 
 >>> data = MyModel(key=u"foo/bar")
->>> print data.key
-foo/bar
+>>> repr(data.key)
+"u'foo/bar'"
 
 About keys
 ==========
 DynamoDB-Mapper as part of 1.8.0 release cycle.
 
 Before writing any validator relying on Onctuous, there is a crucial point to
-take into account. Validators are ran when loading from DynamoDB *and* when saving
-to DynamoDB. ``Save`` stores the output of the validators while reading functions feeds the
+take into account. Validators are run when loading from DynamoDB *and* when saving
+to DynamoDB. ``save`` stores the output of the validators while reading functions feeds the
 validators with raw DynamoDB values that is to say, the serialized output of the
 validators.
 

dynamodb_mapper/model.py

 """
 from __future__ import absolute_import
 
-import json
-import logging
+import json, logging, copy
 from datetime import datetime, timedelta, tzinfo
 
 from onctuous.schema import Schema
             if name in kwargs:
                 value = kwargs.get(name)
             elif name in defaults:
-                value = defaults[name]
+                value = copy.deepcopy(defaults[name])
             else:
                 value = None
             setattr(self, name, value)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.