Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions aeroolib/plugins/opendocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ def check_except_directive( expr):
else:
expr = check_except_directive(expr) and "__filter(%s)" % statement.attrib["{%s}description" % self.namespaces['text']][1:-1] or expr
elif statement.tag == text_a:
expr = urllib.unquote(statement.attrib[xlink_href_attrib][9:])
expr = check_except_directive(expr) and "__filter(%s)" % urllib.unquote(statement.attrib[xlink_href_attrib][9:]) or expr
expr = urllib.parse.unquote(statement.attrib[xlink_href_attrib][9:])
expr = check_except_directive(expr) and "__filter(%s)" % urllib.parse.unquote(statement.attrib[xlink_href_attrib][9:]) or expr

if not expr:
raise OOTemplateError("No expression in the tag",
Expand Down Expand Up @@ -499,8 +499,7 @@ def _handle_column_loops(self, statement, ancestor, opening,
repeat_tag = '{%s}repeat' % AEROO_URI

# table node (it is not necessarily the direct parent of ancestor)
table_node = ancestor.iterancestors('{%s}table' % table_namespace) \
.next()
table_node = next(ancestor.iterancestors('{%s}table' % table_namespace))
table_name = table_node.attrib['{%s}name' % table_namespace]

# add counting instructions
Expand Down Expand Up @@ -643,7 +642,7 @@ def _handle_row_spanned_column_loops(self, statement, outer_o_node,
assert row_node.tag == table_row_tag
next_rows = row_node.itersiblings(table_row_tag)
for row_idx in range(rows_spanned-1):
next_row_node = next_rows.next()
next_row_node = next(next_rows)
rows_to_wrap.append(next_row_node)
# compute the start and end nodes
first = next_row_node[opening_pos]
Expand Down Expand Up @@ -688,7 +687,7 @@ def _handle_hyperlinks(self, tree):
href_attrib = '{%s}href' % self.namespaces['xlink']
py_attrs = '{%s}attrs' % self.namespaces['py']
for a in tree.xpath(xpath_href_expr, namespaces=self.namespaces):
a.attrib[py_attrs] = "__aeroo_hyperlink(%s)" % urllib.unquote(a.attrib[href_attrib]).replace('python://','').replace('pythonuri://','')#[9:]
a.attrib[py_attrs] = "__aeroo_hyperlink(%s)" % urllib.parse.unquote(a.attrib[href_attrib]).replace('python://','').replace('pythonuri://','')#[9:]
del a.attrib[href_attrib]

def _handle_innerdocs(self, tree):
Expand Down Expand Up @@ -1017,7 +1016,7 @@ def check_new_lines(self, tree, namespaces):
next_child = new_parent_node
try:
while(True):
curr_child = parent_children.next()
curr_child = next(parent_children)
if curr_child.tag=='{%s}span' % namespaces['text'] and tag.text==curr_child.text:
new_span_node = EtreeElement('{%s}span' % namespaces['text'],
attrib=tag.attrib,
Expand Down Expand Up @@ -1047,14 +1046,14 @@ def check_new_lines(self, tree, namespaces):
try:
next_text = True
while(next_text):
next_child = parent_children.next()
next_child = next(parent_children)
curr_child.append(next_child)
next_text = next_child.text
except StopIteration:
pass
try:
while(True):
next_child = parent_children.next()
next_child = next(parent_children)
if not next_child.text:
curr_child.append(next_child)
else:
Expand Down Expand Up @@ -1088,7 +1087,7 @@ def check_guess_type(self, tree, namespaces):
guess_type = 'float'
tag.attrib['{%s}value' % namespaces['office']] = tag[0].text
# AKRETION HACK https://github.com/aeroo/aeroolib/issues/7
tag.attrib['{%s}value-type' % namespaces['calcext']] = guess_type
tag.attrib['{%s}value-type' % namespaces.get('calcext')] = guess_type
except (ValueError,TypeError):
guess_type = 'string'
tag.attrib['{%s}value-type' % namespaces['office']] = guess_type
Expand Down
1 change: 0 additions & 1 deletion aeroolib/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

import os, sys

import pkg_resources
from genshi.template import TemplateLoader

def _absolute(path):
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ def get_version():
version=get_version(),
packages=find_packages(),
python_requires='>=3',
# use this genshi version to fix error when, for eg, you send arguments like "date=True" check this https://genshi.edgewall.org/ticket/600
dependency_links=[
'git+https://github.com/edgewall/genshi.git/@stable/0.7.x#egg=genshi-0',
],
install_requires=[
"Genshi >= 0.5",
# "genshi >= 0.5",
"genshi",
"lxml >= 2.0"
],
classifiers=[
Expand Down