This commit is contained in:
Cédric Krier committed 2010-03-04 14:02:53 +01:00
commit 00677cc383
2 files changed
+7

No files matched your search

+5
View File
@@ -78,6 +78,9 @@ def date_trunc(_type, date):
def split_part(text, delimiter, count):
return (text.split(delimiter) + [''] * (count - 1))[count - 1]
def replace(text, pattern, replacement):
return str(text).replace(pattern, replacement)
class Database(DatabaseInterface):
@@ -109,6 +112,8 @@ class Database(DatabaseInterface):
self._conn.create_function('extract', 2, extract)
self._conn.create_function('date_trunc', 2, date_trunc)
self._conn.create_function('split_part', 3, split_part)
if sqlite.sqlite_version_info < (3, 3, 14):
self._conn.create_function('replace', 3, replace)
return self
def cursor(self, autocommit=False):
+2
View File
@@ -25,6 +25,8 @@ def _inherit_apply(src, inherit):
tree_inherit = etree.fromstring(inherit)
root_inherit = tree_inherit.getroottree().getroot()
for element2 in root_inherit:
if element2.tag != 'xpath':
continue
element = _find(tree_src, element2)
if element is not None:
pos = element2.get('position', 'inside')