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:
P. Christeas 2009-02-13 20:23:59 +02:00
commit 086e4a29c6
9 changed files with 50 additions and 20 deletions

View File

@ -272,6 +272,17 @@ def get_modules():
return list(set(listdir(ad) + listdir(_ad))) 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): def create_graph(cr, module_list, force=None):
graph = Graph() 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) logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: creating or updating database tables' % module_name)
todo = [] todo = []
for obj in obj_list: for obj in obj_list:
if hasattr(obj, 'init'):
obj.init(cr)
result = obj._auto_init(cr, {'module': module_name}) result = obj._auto_init(cr, {'module': module_name})
if result: if result:
todo += result todo += result
if hasattr(obj, 'init'):
obj.init(cr)
cr.commit() cr.commit()
todo.sort() todo.sort()
for t in todo: for t in todo:

View File

@ -155,12 +155,8 @@ class char(_column):
# we need to convert the string to a unicode object to be able # we need to convert the string to a unicode object to be able
# to evaluate its length (and possibly truncate it) reliably # to evaluate its length (and possibly truncate it) reliably
if isinstance(symb, str): u_symb = tools.ustr(symb)
u_symb = unicode(symb, 'utf8')
elif isinstance(symb, unicode):
u_symb = symb
else:
u_symb = unicode(symb)
return u_symb[:self.size].encode('utf8') return u_symb[:self.size].encode('utf8')

View File

@ -1939,7 +1939,7 @@ class orm(orm_template):
return "COALESCE(write_date, create_date, now())::timestamp AS %s" % (f,) return "COALESCE(write_date, create_date, now())::timestamp AS %s" % (f,)
return "now()::timestamp AS %s" % (f,) return "now()::timestamp AS %s" % (f,)
if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): 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,) return '"%s"' % (f,)
fields_pre2 = map(convert_field, fields_pre) fields_pre2 = map(convert_field, fields_pre)
for i in range(0, len(ids), cr.IN_MAX): for i in range(0, len(ids), cr.IN_MAX):

View File

@ -23,7 +23,7 @@
name = 'openerp-server' name = 'openerp-server'
version = '5.0.0' version = '5.0.0'
release = '2' release = '3'
major_version = '5.0' major_version = '5.0'
description = 'OpenERP Server' description = 'OpenERP Server'
long_desc = '''\ long_desc = '''\
@ -35,7 +35,7 @@ customizable reports, and XML-RPC interfaces.
''' '''
classifiers = """\ classifiers = """\
Development Status :: 5 - Production/Stable 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 Programming Language :: Python
""" """
url = 'http://www.openerp.com' url = 'http://www.openerp.com'

View File

@ -320,6 +320,7 @@ class common(netsvc.Service):
self.exportMethod(self.login) self.exportMethod(self.login)
self.exportMethod(self.logout) self.exportMethod(self.logout)
self.exportMethod(self.timezone_get) self.exportMethod(self.timezone_get)
self.exportMethod(self.get_available_updates)
self.exportMethod(self.get_migration_scripts) self.exportMethod(self.get_migration_scripts)
def ir_set(self, db, uid, password, keys, args, name, value, replace=True, isobject=False): 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): def timezone_get(self, db, login, password):
return time.tzname[0] 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): def get_migration_scripts(self, password, contract_id, contract_password):
security.check_super(password) security.check_super(password)
l = netsvc.Logger() l = netsvc.Logger()
import tools.maintenance as tm
try: try:
import tools.maintenance as tm
rc = tm.remote_contract(contract_id, contract_password) rc = tm.remote_contract(contract_id, contract_password)
if not rc.id: if not rc.id:
raise tm.RemoteContractException('This contract does not exist or is not active') 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,)) 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 from shutil import rmtree, copytree, copy

View File

@ -677,11 +677,19 @@ def ustr(value):
if not isinstance(value, str): if not isinstance(value, str):
value = str(value) value = str(value)
try: try: # first try utf-8
return unicode(value, 'utf-8') return unicode(value, 'utf-8')
except: except:
from locale import getlocale pass
return unicode(value, getlocale()[1])
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): def exception_to_unicode(e):
if hasattr(e, 'message'): if hasattr(e, 'message'):

View File

@ -60,7 +60,7 @@ class GettextAlias(object):
frame = inspect.stack()[1][0] frame = inspect.stack()[1][0]
cr = frame.f_locals.get('cr') cr = frame.f_locals.get('cr')
try: 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): if not (lang and cr):
return source return source
except: except:
@ -561,7 +561,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
fail = True fail = True
for ln in get_locales(lang): for ln in get_locales(lang):
try: try:
locale.setlocale(locale.LC_ALL, ln) locale.setlocale(locale.LC_ALL, str(ln))
fail = False fail = False
break break
except locale.Error: except locale.Error:

View File

@ -6,7 +6,7 @@ formats=rpm
[bdist_rpm] [bdist_rpm]
# release must exactly match 'release' as set in bin/release.py # release must exactly match 'release' as set in bin/release.py
release=2 release=3
requires=python >= 2.4 requires=python >= 2.4
#build-requires=python-devel >= 2.3 #build-requires=python-devel >= 2.3

View File

@ -173,7 +173,7 @@ setup(name = name,
'openerp-server.tools', 'openerp-server.tools',
'openerp-server.report', 'openerp-server.report',
'openerp-server.report.printscreen', 'openerp-server.report.printscreen',
'openerp-server.report.pyPdf', 'openerp-server.report.pyPdf',
'openerp-server.report.render', 'openerp-server.report.render',
'openerp-server.report.render.rml2pdf', 'openerp-server.report.render.rml2pdf',
'openerp-server.report.render.rml2html', 'openerp-server.report.render.rml2html',