[IMP] ir.property: fixed compatibility with python 2.5
bzr revid: odo@openerp.com-20100924101545-2baak1xfh0v8z04n
This commit is contained in:
parent
35acf33537
commit
e4e6e04a61
|
@ -20,8 +20,9 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import osv,fields
|
from osv import osv,fields
|
||||||
from operator import attrgetter
|
from tools.misc import attrgetter
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Properties
|
# Properties
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
|
@ -1406,5 +1406,24 @@ def upload_data(email, data, type='SURVEY'):
|
||||||
a = upload_data_thread(email, data, type)
|
a = upload_data_thread(email, data, type)
|
||||||
a.start()
|
a.start()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
# port of python 2.6's attrgetter with support for dotted notation
|
||||||
|
def resolve_attr(obj, attr):
|
||||||
|
for name in attr.split("."):
|
||||||
|
obj = getattr(obj, name)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def attrgetter(*items):
|
||||||
|
if len(items) == 1:
|
||||||
|
attr = items[0]
|
||||||
|
def g(obj):
|
||||||
|
return resolve_attr(obj, attr)
|
||||||
|
else:
|
||||||
|
def g(obj):
|
||||||
|
return tuple(resolve_attr(obj, attr) for attr in items)
|
||||||
|
return g
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue