Skip to content

Instantly share code, notes, and snippets.

@dirceu
Created October 29, 2008 18:18
Show Gist options
  • Save dirceu/20777 to your computer and use it in GitHub Desktop.
Save dirceu/20777 to your computer and use it in GitHub Desktop.
def ATSAObjectField_get(self, instance, **kwargs):
__traceback_info__ = (self.getName(), instance, kwargs)
storage = self.getStorage(instance)
original_storage = config.storages.get(instance.__class__.__name__ + self.getName(), None)
if original_storage:
storage = original_storage
try:
kwargs['field'] = self
r = storage.get(self.getName(), instance, **kwargs)
except AttributeError:
# happens if new Atts are added and not yet stored in the instance
if not kwargs.get('_initializing_', False):
self.set(instance, self.getDefault(instance), _initializing_=True, **kwargs)
r = self.getDefault(instance)
return r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment