dirceu (owner)

Revisions

gist: 20777 Download_button fork
public
Public Clone URL: git://gist.github.com/20777.git
Embed All Files: show embed
patch.py #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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