[FIX] osv,tools: break some circular dependencies
bzr revid: odo@openerp.com-20101229105004-ay1e69aujci1l32i
This commit is contained in:
parent
bcaa136fa3
commit
761c638a54
|
@ -59,8 +59,10 @@ from query import Query
|
|||
import tools
|
||||
from tools.safe_eval import safe_eval as eval
|
||||
|
||||
regex_order = re.compile('^(([a-z0-9_]+|"[a-z0-9_]+")( *desc| *asc)?( *, *|))+$', re.I)
|
||||
# List of etree._Element subclasses that we choose to ignore when parsing XML.
|
||||
from tools import SKIPPED_ELEMENT_TYPES
|
||||
|
||||
regex_order = re.compile('^(([a-z0-9_]+|"[a-z0-9_]+")( *desc| *asc)?( *, *|))+$', re.I)
|
||||
|
||||
POSTGRES_CONFDELTYPES = {
|
||||
'RESTRICT': 'r',
|
||||
|
@ -70,10 +72,6 @@ POSTGRES_CONFDELTYPES = {
|
|||
'SET DEFAULT': 'd',
|
||||
}
|
||||
|
||||
# List of etree._Element subclasses that we choose to ignore when parsing view architecture.
|
||||
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
|
||||
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
|
||||
|
||||
def last_day_of_current_month():
|
||||
today = datetime.date.today()
|
||||
last_day = str(calendar.monthrange(today.year, today.month)[1])
|
||||
|
|
|
@ -45,10 +45,12 @@ import netsvc
|
|||
import osv
|
||||
import pooler
|
||||
from config import config
|
||||
from osv.orm import except_orm, SKIPPED_ELEMENT_TYPES
|
||||
from tools.translate import _
|
||||
from yaml_import import convert_yaml_import
|
||||
|
||||
# List of etree._Element subclasses that we choose to ignore when parsing XML.
|
||||
from tools import SKIPPED_ELEMENT_TYPES
|
||||
|
||||
# Import of XML records requires the unsafe eval as well,
|
||||
# almost everywhere, which is ok because it supposedly comes
|
||||
# from trusted data, but at least we make it obvious now.
|
||||
|
@ -865,7 +867,7 @@ form: module.record_id""" % (xml_id,)
|
|||
self.__logger.error('Parse error in %s:%d: \n%s',
|
||||
rec.getroottree().docinfo.URL,
|
||||
rec.sourceline,
|
||||
etree.tostring(rec).strip())
|
||||
etree.tostring(rec).strip(), exc_info=True)
|
||||
self.cr.rollback()
|
||||
raise
|
||||
return True
|
||||
|
@ -945,7 +947,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
|
|||
result, rows, warning_msg, dummy = pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial)
|
||||
if result < 0:
|
||||
# Report failed import and abort module install
|
||||
raise except_orm(_('Module loading failed'), _('Loading %s/%s failed:\n %s') % (module, fname, warning_msg))
|
||||
raise Exception(_('Module loading failed: file %s/%s could not be processed:\n %s') % (module, fname, warning_msg))
|
||||
if config.get('import_partial'):
|
||||
data = pickle.load(file(config.get('import_partial')))
|
||||
data[fname_partial] = 0
|
||||
|
|
|
@ -44,6 +44,7 @@ from email.Header import Header
|
|||
from email.Utils import formatdate, COMMASPACE
|
||||
from email import Encoders
|
||||
from itertools import islice, izip
|
||||
from lxml import etree
|
||||
from which import which
|
||||
if sys.version_info[:2] < (2, 4):
|
||||
from threadinglocal import local
|
||||
|
@ -60,6 +61,10 @@ from lru import LRU
|
|||
|
||||
_logger = logging.getLogger('tools')
|
||||
|
||||
# List of etree._Element subclasses that we choose to ignore when parsing XML.
|
||||
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
|
||||
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
|
||||
|
||||
# initialize a database with base/base.sql
|
||||
def init_db(cr):
|
||||
import addons
|
||||
|
|
Loading…
Reference in New Issue