Merge commit 'origin/master' into mdv-gpl3-py26
Conflicts: bin/tools/translate.py setup.py bzr revid: p_christ@hol.gr-20090213182359-arcslht0h9ix34qr
This commit is contained in:
commit
086e4a29c6
|
@ -272,6 +272,17 @@ def get_modules():
|
|||
|
||||
return list(set(listdir(ad) + listdir(_ad)))
|
||||
|
||||
def get_modules_with_version():
|
||||
modules = get_modules()
|
||||
res = {}
|
||||
for module in modules:
|
||||
terp = get_module_resource(module, '__terp__.py')
|
||||
try:
|
||||
info = eval(tools.file_open(terp).read())
|
||||
res[module] = "%s.%s" % (release.major_version, info['version'])
|
||||
except Exception, e:
|
||||
continue
|
||||
return res
|
||||
|
||||
def create_graph(cr, module_list, force=None):
|
||||
graph = Graph()
|
||||
|
@ -337,11 +348,11 @@ def init_module_objects(cr, module_name, obj_list):
|
|||
logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: creating or updating database tables' % module_name)
|
||||
todo = []
|
||||
for obj in obj_list:
|
||||
if hasattr(obj, 'init'):
|
||||
obj.init(cr)
|
||||
result = obj._auto_init(cr, {'module': module_name})
|
||||
if result:
|
||||
todo += result
|
||||
if hasattr(obj, 'init'):
|
||||
obj.init(cr)
|
||||
cr.commit()
|
||||
todo.sort()
|
||||
for t in todo:
|
||||
|
|
|
@ -155,12 +155,8 @@ class char(_column):
|
|||
|
||||
# we need to convert the string to a unicode object to be able
|
||||
# to evaluate its length (and possibly truncate it) reliably
|
||||
if isinstance(symb, str):
|
||||
u_symb = unicode(symb, 'utf8')
|
||||
elif isinstance(symb, unicode):
|
||||
u_symb = symb
|
||||
else:
|
||||
u_symb = unicode(symb)
|
||||
u_symb = tools.ustr(symb)
|
||||
|
||||
return u_symb[:self.size].encode('utf8')
|
||||
|
||||
|
||||
|
|
|
@ -1939,7 +1939,7 @@ class orm(orm_template):
|
|||
return "COALESCE(write_date, create_date, now())::timestamp AS %s" % (f,)
|
||||
return "now()::timestamp AS %s" % (f,)
|
||||
if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False):
|
||||
return "length(%s) as %s" % (f,f)
|
||||
return 'length("%s") as "%s"' % (f, f)
|
||||
return '"%s"' % (f,)
|
||||
fields_pre2 = map(convert_field, fields_pre)
|
||||
for i in range(0, len(ids), cr.IN_MAX):
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
name = 'openerp-server'
|
||||
version = '5.0.0'
|
||||
release = '2'
|
||||
release = '3'
|
||||
major_version = '5.0'
|
||||
description = 'OpenERP Server'
|
||||
long_desc = '''\
|
||||
|
@ -35,7 +35,7 @@ customizable reports, and XML-RPC interfaces.
|
|||
'''
|
||||
classifiers = """\
|
||||
Development Status :: 5 - Production/Stable
|
||||
License :: OSI Approved :: GNU General Public License Version 3 (GPL-3)
|
||||
License :: OSI Approved :: GNU General Public License (GPL)
|
||||
Programming Language :: Python
|
||||
"""
|
||||
url = 'http://www.openerp.com'
|
||||
|
|
|
@ -320,6 +320,7 @@ class common(netsvc.Service):
|
|||
self.exportMethod(self.login)
|
||||
self.exportMethod(self.logout)
|
||||
self.exportMethod(self.timezone_get)
|
||||
self.exportMethod(self.get_available_updates)
|
||||
self.exportMethod(self.get_migration_scripts)
|
||||
|
||||
def ir_set(self, db, uid, password, keys, args, name, value, replace=True, isobject=False):
|
||||
|
@ -385,12 +386,26 @@ GNU Public Licence.
|
|||
def timezone_get(self, db, login, password):
|
||||
return time.tzname[0]
|
||||
|
||||
|
||||
def get_available_updates(self, password, contract_id, contract_password):
|
||||
security.check_super(password)
|
||||
import tools.maintenance as tm
|
||||
try:
|
||||
rc = tm.remote_contract(contract_id, contract_password)
|
||||
if not rc.id:
|
||||
raise tm.RemoteContractException('This contract does not exist or is not active')
|
||||
|
||||
return rc.get_available_updates(rc.id, addons.get_modules_with_version())
|
||||
|
||||
except tm.RemoteContractException, e:
|
||||
self.abortResponse(1, 'Migration Error', 'warning', str(e))
|
||||
|
||||
|
||||
def get_migration_scripts(self, password, contract_id, contract_password):
|
||||
security.check_super(password)
|
||||
l = netsvc.Logger()
|
||||
import tools.maintenance as tm
|
||||
try:
|
||||
import tools.maintenance as tm
|
||||
rc = tm.remote_contract(contract_id, contract_password)
|
||||
if not rc.id:
|
||||
raise tm.RemoteContractException('This contract does not exist or is not active')
|
||||
|
@ -399,7 +414,7 @@ GNU Public Licence.
|
|||
|
||||
l.notifyChannel('migration', netsvc.LOG_INFO, 'starting migration with contract %s' % (rc.name,))
|
||||
|
||||
zips = rc.retrieve_updates(rc.id)
|
||||
zips = rc.retrieve_updates(rc.id, addons.get_modules_with_version())
|
||||
|
||||
from shutil import rmtree, copytree, copy
|
||||
|
||||
|
|
|
@ -677,11 +677,19 @@ def ustr(value):
|
|||
if not isinstance(value, str):
|
||||
value = str(value)
|
||||
|
||||
try:
|
||||
try: # first try utf-8
|
||||
return unicode(value, 'utf-8')
|
||||
except:
|
||||
from locale import getlocale
|
||||
return unicode(value, getlocale()[1])
|
||||
pass
|
||||
|
||||
try: # then extened iso-8858
|
||||
return unicode(value, 'iso-8859-15')
|
||||
except:
|
||||
pass
|
||||
|
||||
# else use default system locale
|
||||
from locale import getlocale
|
||||
return unicode(value, getlocale()[1])
|
||||
|
||||
def exception_to_unicode(e):
|
||||
if hasattr(e, 'message'):
|
||||
|
|
|
@ -60,7 +60,7 @@ class GettextAlias(object):
|
|||
frame = inspect.stack()[1][0]
|
||||
cr = frame.f_locals.get('cr')
|
||||
try:
|
||||
lang = frame.f_locals.get('context', {}).get('lang', False)
|
||||
lang = (frame.f_locals.get('context') or {}).get('lang', False)
|
||||
if not (lang and cr):
|
||||
return source
|
||||
except:
|
||||
|
@ -561,7 +561,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
|
|||
fail = True
|
||||
for ln in get_locales(lang):
|
||||
try:
|
||||
locale.setlocale(locale.LC_ALL, ln)
|
||||
locale.setlocale(locale.LC_ALL, str(ln))
|
||||
fail = False
|
||||
break
|
||||
except locale.Error:
|
||||
|
|
|
@ -6,7 +6,7 @@ formats=rpm
|
|||
|
||||
[bdist_rpm]
|
||||
# release must exactly match 'release' as set in bin/release.py
|
||||
release=2
|
||||
release=3
|
||||
|
||||
requires=python >= 2.4
|
||||
#build-requires=python-devel >= 2.3
|
||||
|
|
2
setup.py
2
setup.py
|
@ -173,7 +173,7 @@ setup(name = name,
|
|||
'openerp-server.tools',
|
||||
'openerp-server.report',
|
||||
'openerp-server.report.printscreen',
|
||||
'openerp-server.report.pyPdf',
|
||||
'openerp-server.report.pyPdf',
|
||||
'openerp-server.report.render',
|
||||
'openerp-server.report.render.rml2pdf',
|
||||
'openerp-server.report.render.rml2html',
|
||||
|
|
Loading…
Reference in New Issue