File 0001-Fix-the-code-to-work-with-Python2.6.patch of Package python-sphinxcontrib-docbookrestapi
From 9ad4e8f5fe41b3c9bf334a3f9aea925a5128eddc Mon Sep 17 00:00:00 2001
From: Cyril Roelandt <cyril.roelandt@enovance.com>
Date: Fri, 29 Nov 2013 18:44:09 +0100
Subject: [PATCH] Fix the code to work with Python2.6
It was previously using some features introduced in Python2.7.
Change-Id: I3b4b2895f231cf98235efd16f65eb123db8a9157
---
sphinxcontrib/docbookrestapi/docbook.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sphinxcontrib/docbookrestapi/docbook.py b/sphinxcontrib/docbookrestapi/docbook.py
index 63ecfd9..e923e53 100644
--- a/sphinxcontrib/docbookrestapi/docbook.py
+++ b/sphinxcontrib/docbookrestapi/docbook.py
@@ -30,7 +30,7 @@ def generate_id(path, method):
path = path.replace('(', '')
path = path.replace(')', '')
elems = path.split('/')
- elems = filter(lambda x: x, elems) # Remove empty strings
+ elems = list(filter(lambda x: x, elems)) # Remove empty strings
elems = elems[1:] # Remove "vx" (v1, v2...)
n_elems = len(elems)
@@ -189,12 +189,12 @@ class MyNodeVisitor(SparseNodeVisitor):
self.in_method_definition = False
def visit_desc(self, node):
- attrs = {k: v for (k, v) in node.attlist()}
+ attrs = dict(node.attlist())
if attrs['domain'] == 'http':
self.in_method_definition = True
def visit_desc_signature(self, node):
- attrs = {k: v for (k, v) in node.attlist()}
+ attrs = dict(node.attlist())
if 'method' in attrs and 'path' in attrs:
method_id = generate_id(attrs['path'], attrs['method'])
self.current_method = ET.Element('method', {
--
1.9.0