equal
deleted
inserted
replaced
31 |
31 |
32 class Storage(object): |
32 class Storage(object): |
33 """abstract storage |
33 """abstract storage |
34 |
34 |
35 * If `source_callback` is true (by default), the callback will be run during |
35 * If `source_callback` is true (by default), the callback will be run during |
36 query result process of fetched attribute's valu and should have the |
36 query result process of fetched attribute's value and should have the |
37 following prototype:: |
37 following prototype:: |
38 |
38 |
39 callback(self, source, value) |
39 callback(self, source, session, value) |
40 |
40 |
41 where `value` is the value actually stored in the backend. None values |
41 where `value` is the value actually stored in the backend. None values |
42 will be skipped (eg callback won't be called). |
42 will be skipped (eg callback won't be called). |
43 |
43 |
44 * if `source_callback` is false, the callback will be run during sql |
44 * if `source_callback` is false, the callback will be run during sql |
97 """store Bytes attribute value on the file system""" |
97 """store Bytes attribute value on the file system""" |
98 def __init__(self, defaultdir, fsencoding='utf-8'): |
98 def __init__(self, defaultdir, fsencoding='utf-8'): |
99 self.default_directory = defaultdir |
99 self.default_directory = defaultdir |
100 self.fsencoding = fsencoding |
100 self.fsencoding = fsencoding |
101 |
101 |
102 def callback(self, source, value): |
102 def callback(self, source, session, value): |
103 """sql generator callback when some attribute with a custom storage is |
103 """sql generator callback when some attribute with a custom storage is |
104 accessed |
104 accessed |
105 """ |
105 """ |
106 fpath = source.binary_to_str(value) |
106 fpath = source.binary_to_str(value) |
107 try: |
107 try: |