Skip to content

Commit

Permalink
Merge branch 'py3-compatibility' of https://github.com/kitconcept/rob…
Browse files Browse the repository at this point in the history
…otframework-hub into kitconcept-py3-compatibility

Conflicts:
	requirements.txt
  • Loading branch information
Bryan Oakley committed Jun 9, 2016
2 parents b06ba49 + b4504d9 commit dda3fd5
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ argh==0.25.0
itsdangerous==0.24
pathtools==0.1.2
requests==2.10.0
robotframework==2.8.5
robotframework>=2.8.5
robotframework-requests==0.4.5
robotframework-selenium2library==1.7.4
watchdog==0.8.0
wsgiref==0.1.2
# wsgiref==0.1.2
10 changes: 5 additions & 5 deletions rfhub/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self):
self.args = self._parse_args()

if self.args.version:
print __version__
print(__version__)
sys.exit(0)

self.kwdb = KeywordTable(poll=self.args.poll)
Expand Down Expand Up @@ -96,7 +96,7 @@ def _parse_args(self):
help="Redirect root url (http://localhost:port/) to this url (eg: /dashboard, /doc)")
parser.add_argument("--version", action="store_true", default=False,
help="Display version number and exit")
parser.add_argument("path", nargs="*",
parser.add_argument("path", nargs="*",
help="zero or more paths to folders, libraries or resource files")
return parser.parse_args()

Expand All @@ -120,7 +120,7 @@ def _load_keyword_data(self, paths, no_install_keywords):
try:
self.kwdb.add(path)
except Exception as e:
print "Error adding keywords in %s: %s" % (path, str(e))
print("Error adding keywords in %s: %s" % (path, str(e)))

class ArgfileAction(argparse.Action):
'''Called when the argument parser encounters --argumentfile'''
Expand Down Expand Up @@ -151,7 +151,7 @@ class ModuleAction(argparse.Action):
This works by importing the module given as an argument to the
option, and then looking for all members of the module that
are classes
are classes
For example, if you give the option "pages.MyApp", this will
attempt to import the module "pages.MyApp", and search for the classes
Expand All @@ -177,4 +177,4 @@ def __call__(self, parser, namespace, arg, option_string = None):
namespace.library.append(libname)

except ImportError as e:
print "unable to import '%s' : %s" % (arg,e)
print("unable to import '%s' : %s" % (arg,e))
7 changes: 3 additions & 4 deletions rfhub/blueprints/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from api import blueprint as api
from dashboard import blueprint as dashboard
from doc import blueprint as doc

from rfhub.blueprints.api import blueprint as api
from rfhub.blueprints.dashboard import blueprint as dashboard
from rfhub.blueprints.doc import blueprint as doc
12 changes: 6 additions & 6 deletions rfhub/blueprints/api/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, blueprint):
blueprint.add_url_rule("/keywords/", view_func = self.get_keywords)
blueprint.add_url_rule("/keywords/<collection_id>", view_func = self.get_library_keywords)
blueprint.add_url_rule("/keywords/<collection_id>/<keyword>", view_func = self.get_library_keyword)

def get_library_keywords(self,collection_id):

query_pattern = flask.request.args.get('pattern', "*").strip().lower()
Expand All @@ -36,12 +36,12 @@ def get_library_keywords(self,collection_id):
if ("doc" in fields): data["doc"] = keyword_doc
if ("args" in fields): data["args"] = keyword_args

if ("doc_keyword_url" in fields):
if ("doc_keyword_url" in fields):
data["doc_keyword_url"] = flask.url_for("doc.doc_for_library",
collection_id=keyword_collection_id,
keyword=keyword_name)
if ("api_keyword_url" in fields):
data["api_keyword_url"] = flask.url_for(".get_library_keyword",
data["api_keyword_url"] = flask.url_for(".get_library_keyword",
collection_id=keyword_collection_id,
keyword=keyword_name)

Expand All @@ -51,7 +51,7 @@ def get_library_keywords(self,collection_id):
if ("htmldoc" in fields):
try:
data["htmldoc"] = DocToHtml("ROBOT")(keyword_doc)
except Exception, e:
except Exception as e:
data["htmldoc"] = "";
htmldoc = "bummer", e

Expand All @@ -75,11 +75,11 @@ def get_library_keyword(self, collection_id, keyword):
else:
# need to redirect to a disambiguation page
flask.abort(404)

try:
keyword = kwdb.get_keyword(collection_id, keyword)

except Exception, e:
except Exception as e:
current_app.logger.warning(e)
flask.abort(404)

Expand Down
4 changes: 2 additions & 2 deletions rfhub/blueprints/api/libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ApiEndpoint(object):
def __init__(self, blueprint):
blueprint.add_url_rule("/libraries/", view_func = self.get_libraries)
blueprint.add_url_rule("/libraries/<collection_id>", view_func = self.get_library)

def get_libraries(self):
kwdb = current_app.kwdb

Expand All @@ -20,7 +20,7 @@ def get_libraries(self):

def get_library(self, collection_id):
# if collection_id is a library _name_, redirect
print "get_library: collection_id=", collection_id
print("get_library: collection_id=", collection_id)
kwdb = current_app.kwdb
collection = kwdb.get_collection(collection_id)
return flask.jsonify(collection=collection)
16 changes: 8 additions & 8 deletions rfhub/kwdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ def add_file(self, path):
if len(libdoc.keywords) > 0:
if libdoc.doc.startswith("Documentation for resource file"):
# bah! The file doesn't have an file-level documentation
# and libdoc substitutes some placeholder text.
# and libdoc substitutes some placeholder text.
libdoc.doc = ""

collection_id = self.add_collection(path, libdoc.name, libdoc.type,
libdoc.doc, libdoc.version,
libdoc.scope, libdoc.named_args,
Expand Down Expand Up @@ -193,9 +193,9 @@ def add_folder(self, dirname, watch=True):
if (ext in (".xml", ".robot", ".txt", ".py", ".tsv")):
if os.access(path, os.R_OK):
self.add(path)
except Exception, e:
except Exception as e:
# I really need to get the logging situation figured out.
print "bummer:", str(e)
print("bummer:", str(e))

# FIXME:
# instead of passing a flag around, I should just keep track
Expand Down Expand Up @@ -248,7 +248,7 @@ def add_installed_libraries(self, extra_libs = ["Selenium2Library",
try:
self.add(libname)
loaded.append(libname.lower())
except Exception, e:
except Exception as e:
# need a better way to log this...
self.log.debug("unable to add library: " + str(e))

Expand All @@ -261,7 +261,7 @@ def add_installed_libraries(self, extra_libs = ["Selenium2Library",
try:
self.add(library)
loaded.append(library.lower())
except Exception, e:
except Exception as e:
self.log.debug("unable to add external library %s: %s" % \
(library, str(e)))

Expand Down Expand Up @@ -378,7 +378,7 @@ def search(self, pattern="*", mode="both"):
"""Perform a pattern-based search on keyword names and documentation
The pattern matching is insensitive to case. The function
returns a list of tuples of the form library_id, library_name,
returns a list of tuples of the form library_id, library_name,
keyword_name, keyword_synopsis, sorted by library id,
library name, and then keyword name
Expand All @@ -399,7 +399,7 @@ def search(self, pattern="*", mode="both"):
if mode == "name":
COND = "(keyword.name like ?)"
args = [pattern,]

sql = """SELECT collection.collection_id, collection.name, keyword.name, keyword.doc
FROM collection_table as collection
JOIN keyword_table as keyword
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# in rfhub/version.py and then run 'python setup.py sdist upload'
from setuptools import setup

execfile('rfhub/version.py')
filename = 'rfhub/version.py'
exec(open(filename).read())

setup(
name = 'robotframework-hub',
Expand Down

0 comments on commit dda3fd5

Please sign in to comment.