Merge branch 'master' of openobject-server into mdv-gpl3

Conflicts:
	bin/openerp-server.py

bzr revid: p_christ@hol.gr-20081230132911-6d9bfzlx8j9osj2q
This commit is contained in:
P. Christeas 2008-12-30 15:29:11 +02:00
commit 12bcce44c4
10 changed files with 60 additions and 39 deletions

View File

@ -1,3 +1,4 @@
include rpminstall_sh.txt
include README
include bin/import_xml.rng
include bin/server.cert

View File

@ -154,22 +154,20 @@ def init_logger():
import os
logger = logging.getLogger()
# create a format for log messages and dates
formatter = logging.Formatter('[%(asctime)s] %(levelname)s:%(name)s:%(message)s', '%a %b %d %Y %H:%M:%S')
if tools.config['syslog']:
# SysLog Handler
if os.name == 'nt':
sysloghandler = logging.handlers.NTEventLogHandler("%s %s" %
handler = logging.handlers.NTEventLogHandler("%s %s" %
(release.description,
release.version))
else:
sysloghandler = logging.handlers.SysLogHandler('/dev/log')
formatter = logging.Formatter('%(application)s:%(uncoloredlevelname)s:%(name)s:%(message)s')
sysloghandler.setFormatter(formatter)
logger.addHandler(sysloghandler)
handler = logging.handlers.SysLogHandler('/dev/log')
formatter = logging.Formatter("%s %s" % (release.description, release.version) + ':%(levelname)s:%(name)s:%(message)s')
# create a format for log messages and dates
formatter = logging.Formatter('[%(asctime)s] %(levelname)s:%(name)s:%(message)s', '%a %b %d %Y %H:%M:%S')
if tools.config['logfile']:
elif tools.config['logfile']:
# LogFile Handler
logf = tools.config['logfile']
try:
@ -216,14 +214,6 @@ def init_logger():
class Logger(object):
def uncoloredlevelname(self, level):
# The level'names are globals to all loggers, so we must strip-off the
# color formatting for some specific logger (i.e: syslog)
levelname = logging.getLevelName(getattr(logging, level.upper(), 0))
if levelname.startswith("\x1b["):
return levelname[10:-4]
return levelname
def notifyChannel(self, name, level, msg):
log = logging.getLogger(name)
@ -231,19 +221,14 @@ class Logger(object):
fct = lambda msg, *args, **kwargs: log.log(logging.DEBUG_RPC, msg, *args, **kwargs)
setattr(log, LOG_DEBUG_RPC, fct)
extra = {
'uncoloredlevelname': self.uncoloredlevelname(level),
'application' : "%s %s" % (release.description, release.version),
}
level_method = getattr(log, level)
result = tools.ustr(msg).strip().split('\n')
if len(result)>1:
for idx, s in enumerate(result):
level_method('[%02d]: %s' % (idx+1, s,), extra=extra)
level_method('[%02d]: %s' % (idx+1, s,))
elif result:
level_method(result[0], extra=extra)
level_method(result[0])
import tools
init_logger()

View File

@ -34,7 +34,10 @@ GNU Public Licence.
#----------------------------------------------------------
# python imports
#----------------------------------------------------------
import sys, os, signal,pwd
import sys
import os
import signal
import pwd
#----------------------------------------------------------
# ubuntu 8.04 has obsoleted `pyxml` package and installs here.
# the path needs to be updated before any `import xml`

View File

@ -94,6 +94,9 @@ class browse_null(object):
def __nonzero__(self):
return False
def __unicode__(self):
return u''
#

View File

@ -30,7 +30,7 @@ OpenERP is a complete ERP and CRM. The main features are accounting (analytic
and financial), stock management, sales and purchases management, tasks
automation, marketing campaigns, help desk, POS, etc. Technical features include
a distributed server, flexible workflows, an object database, a dynamic GUI,
customizable reports, and SOAP and XML-RPC interfaces.
customizable reports, and XML-RPC interfaces.
'''
classifiers = """\
Development Status :: 5 - Production/Stable

View File

@ -284,24 +284,21 @@ class rml_parse(object):
oldtag = self.tag
self._node.data = ''
node = self._find_parent(self._node, [oldtag])
ns = None
if node:
pp = node.parentNode
ns = node.nextSibling
pp.removeChild(node)
else:
pp=self._node
self._node = pp
lst=''
if isinstance(text,(str,unicode)):
lst = text.split('\n')
# lst = str(text).split('\n') # This is also acceptable, isn't it?
if lst and (not len(lst)):
self._node = pp
lst = tools.ustr(text).split('\n')
if not (text and lst):
return None
nodes = []
for i in range(len(lst)):
newnode = node.cloneNode(1)
newnode.tagName=rml_tag
newnode.__dict__['childNodes'][0].__dict__['data'] = lst[i].decode('utf8')
newnode.childNodes[0].data = lst[i]
if ns:
pp.insertBefore(newnode, ns)
else:

View File

@ -245,14 +245,14 @@ class db(netsvc.Service):
import pwd
db_user = pwd.getpwuid(os.getuid())[0]
if not db_user:
cr.execute("select usename from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (tools.config["db_name"],))
cr.execute("select decode(usename, 'escape') from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (tools.config["db_name"],))
res = cr.fetchone()
db_user = res and res[0]
db_user = res and str(res[0])
if db_user:
cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in ('template0', 'template1', 'postgres')", (db_user,))
cr.execute("select decode(datname, 'escape') from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in ('template0', 'template1', 'postgres')", (db_user,))
else:
cr.execute("select datname from pg_database where datname not in('template0', 'template1','postgres')")
res = [name for (name,) in cr.fetchall()]
cr.execute("select decode(datname, 'escape') from pg_database where datname not in('template0', 'template1','postgres')")
res = [str(name) for (name,) in cr.fetchall()]
cr.close()
except:
res = []

View File

@ -179,6 +179,7 @@ class configmanager(object):
(opt, args) = parser.parse_args()
assert not (bool(opt.syslog) and bool(opt.logfile)), "the syslog and logfile options are exclusive"
assert not (opt.translate_in and (not opt.language or not opt.db_name)), "the i18n-import option cannot be used without the language (-l) and the database (-d) options"
assert not (opt.translate_out and (not opt.db_name)), "the i18n-export option cannot be used without the database (-d) option"

14
rpminstall_sh.txt Normal file
View File

@ -0,0 +1,14 @@
#
# This file is used by 'python setup.py bdist_rpm'
# You should not execute/call this file yourself.
#
# This script is used as the 'install' part of the RPM .spec file.
#
# Need to overwrite the install-part of the RPM to append the
# compression-suffix onto the filenames for the man-pages.
#
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
SUFFIX=gz
mv INSTALLED_FILES INSTALLED_FILES.orig
sed "s!\(/share/man/.*\)!\1.$SUFFIX!" INSTALLED_FILES.orig > INSTALLED_FILES

17
setup.cfg Normal file
View File

@ -0,0 +1,17 @@
[sdist]
formats=gztar
[bdist]
formats=rpm
[bdist_rpm]
release=1
requires=python >= 2.3
#build-requires=python-devel >= 2.3
#doc_files = doc/*
# Need to overwrite the install-part of the RPM to patch
# the filenames of the man pages.
install_script=rpminstall_sh.txt