commit
4254c4105d
|
@ -322,6 +322,7 @@ def upgrade_graph(graph, cr, module_list, force=None):
|
|||
raise
|
||||
if info.get('installable', True):
|
||||
packages.append((module, info.get('depends', []), info))
|
||||
|
||||
|
||||
dependencies = dict([(p, deps) for p, deps, data in packages])
|
||||
current, later = set([p for p, dep, data in packages]), set()
|
||||
|
@ -669,7 +670,8 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
|||
pool = pooler.get_pool(cr.dbname)
|
||||
try:
|
||||
report = tools.assertion_report()
|
||||
STATES_TO_LOAD = ['installed', 'to upgrade']
|
||||
# NOTE: Try to also load the modules that have been marked as uninstallable previously...
|
||||
STATES_TO_LOAD = ['installed', 'to upgrade', 'uninstallable']
|
||||
graph = create_graph(cr, ['base'], force)
|
||||
has_updates = False
|
||||
if update_module:
|
||||
|
|
|
@ -800,13 +800,14 @@ class orm_template(object):
|
|||
attrs = {}
|
||||
try:
|
||||
if node.getAttribute('name') in self._columns:
|
||||
relation = self._columns[node.getAttribute('name')]._obj
|
||||
column = self._columns[node.getAttribute('name')]
|
||||
else:
|
||||
relation = self._inherit_fields[node.getAttribute('name')][2]._obj
|
||||
column = self._inherit_fields[node.getAttribute('name')][2]
|
||||
except:
|
||||
relation = False
|
||||
column = False
|
||||
|
||||
if relation:
|
||||
if column:
|
||||
relation = column._obj
|
||||
childs = False
|
||||
views = {}
|
||||
for f in node.childNodes:
|
||||
|
@ -821,9 +822,12 @@ class orm_template(object):
|
|||
}
|
||||
attrs = {'views': views}
|
||||
if node.hasAttribute('widget') and node.getAttribute('widget')=='selection':
|
||||
# We can not use the domain has it is defined according to the record !
|
||||
attrs['selection'] = self.pool.get(relation).name_search(cr, user, '', context=context)
|
||||
if not attrs.get('required',False):
|
||||
# We can not use the 'string' domain has it is defined according to the record !
|
||||
dom = None
|
||||
if column._domain and not isinstance(column._domain, (str, unicode)):
|
||||
dom = column._domain
|
||||
attrs['selection'] = self.pool.get(relation).name_search(cr, user, '', dom, context=context)
|
||||
if (node.hasAttribute('required') and not int(node.getAttribute('required'))) or not column.required:
|
||||
attrs['selection'].append((False,''))
|
||||
fields[node.getAttribute('name')] = attrs
|
||||
|
||||
|
|
|
@ -262,7 +262,8 @@ class document(object):
|
|||
if not isinstance(datas[atr['value']], (str, unicode)):
|
||||
txt = self.doc.createTextNode(str(datas[atr['value']]))
|
||||
else:
|
||||
txt = self.doc.createTextNode(datas[atr['value']].decode('utf-8'))
|
||||
# txt = self.doc.createTextNode(datas[atr['value']].decode('utf-8'))
|
||||
txt = self.doc.createTextNode(datas[atr['value']])
|
||||
el.appendChild(txt)
|
||||
else:
|
||||
el_cld = node.firstChild
|
||||
|
|
|
@ -171,7 +171,7 @@ class db(netsvc.Service):
|
|||
security.check_super(password)
|
||||
logger = netsvc.Logger()
|
||||
|
||||
cmd = ['pg_dump', '--format=c']
|
||||
cmd = ['pg_dump', '--format=c', '--no-owner']
|
||||
if tools.config['db_user']:
|
||||
cmd.append('--username=' + tools.config['db_user'])
|
||||
if tools.config['db_host']:
|
||||
|
@ -210,7 +210,7 @@ class db(netsvc.Service):
|
|||
cr.close()
|
||||
sql_db.close_db('template1')
|
||||
|
||||
cmd = ['pg_restore']
|
||||
cmd = ['pg_restore', '--no-owner']
|
||||
if tools.config['db_user']:
|
||||
cmd.append('--username=' + tools.config['db_user'])
|
||||
if tools.config['db_host']:
|
||||
|
|
|
@ -71,7 +71,7 @@ class Cursor(object):
|
|||
|
||||
@wraps(f)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
if not hasattr(self, '_obj'):
|
||||
if self.__closed:
|
||||
raise psycopg2.ProgrammingError('Unable to use the cursor after having closing it')
|
||||
return f(self, *args, **kwargs)
|
||||
return wrapper
|
||||
|
@ -81,6 +81,7 @@ class Cursor(object):
|
|||
self._serialized = serialized
|
||||
self._cnx = pool.getconn()
|
||||
self._obj = self._cnx.cursor(cursor_factory=psycopg1cursor)
|
||||
self.__closed = False
|
||||
self.autocommit(False)
|
||||
self.dbname = pool.dbname
|
||||
|
||||
|
@ -89,7 +90,7 @@ class Cursor(object):
|
|||
self.__caller = tuple(stack()[2][1:3])
|
||||
|
||||
def __del__(self):
|
||||
if hasattr(self, '_obj'):
|
||||
if not self.__closed:
|
||||
if tools.config['log_level'] in (netsvc.LOG_DEBUG, netsvc.LOG_DEBUG_RPC):
|
||||
# Oops. 'self' has not been closed explicitly.
|
||||
# The cursor will be deleted by the garbage collector,
|
||||
|
@ -107,7 +108,7 @@ class Cursor(object):
|
|||
self.count+=1
|
||||
if '%d' in query or '%f' in query:
|
||||
log(query, netsvc.LOG_WARNING)
|
||||
log("SQL queries mustn't containt %d or %f anymore. Use only %s", netsvc.LOG_WARNING)
|
||||
log("SQL queries mustn't contain %d or %f anymore. Use only %s", netsvc.LOG_WARNING)
|
||||
if params:
|
||||
query = query.replace('%d', '%s').replace('%f', '%s')
|
||||
|
||||
|
@ -115,6 +116,7 @@ class Cursor(object):
|
|||
now = mdt.now()
|
||||
|
||||
try:
|
||||
params = params or None
|
||||
res = self._obj.execute(query, params)
|
||||
except Exception, e:
|
||||
log("bad query: %s" % self._obj.query)
|
||||
|
@ -166,6 +168,7 @@ class Cursor(object):
|
|||
# collected as fast as they should). The problem is probably due in
|
||||
# part because browse records keep a reference to the cursor.
|
||||
del self._obj
|
||||
self.__closed = True
|
||||
self._pool.putconn(self._cnx)
|
||||
|
||||
@check
|
||||
|
|
|
@ -388,8 +388,8 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
|
|||
)
|
||||
s.quit()
|
||||
except Exception, e:
|
||||
import logging
|
||||
logging.getLogger().error(str(e))
|
||||
import netsvc
|
||||
netsvc.Logger().notifyChannel('email_send', netsvc.LOG_ERROR, e)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue