Skip to content
Snippets Groups Projects
Commit c6a39929 authored by inso's avatar inso
Browse files

Fix bug with filter nodes and account registration

parent a89b532e
Branches
Tags
No related merge requests found
...@@ -361,6 +361,7 @@ class Account(QObject): ...@@ -361,6 +361,7 @@ class Account(QObject):
try: try:
data = yield from community.bma_access.simple_request(request, data = yield from community.bma_access.simple_request(request,
req_args={'search': search}) req_args={'search': search})
if data:
registered = parsers[request](data) registered = parsers[request](data)
tries += 1 tries += 1
except ValueError as e: except ValueError as e:
......
...@@ -197,10 +197,13 @@ class BmaAccess(QObject): ...@@ -197,10 +197,13 @@ class BmaAccess(QObject):
def filter_nodes(self, request, nodes): def filter_nodes(self, request, nodes):
def compare_versions(node, version): def compare_versions(node, version):
if node.version and node.version != '':
try: try:
return StrictVersion(node.version) > StrictVersion(version) return StrictVersion(node.version) > StrictVersion(version)
except TypeError: except TypeError:
return False return False
else:
return False
filters = { filters = {
bma.ud.History: lambda n: compare_versions(n, "0.11.0"), bma.ud.History: lambda n: compare_versions(n, "0.11.0"),
bma.tx.History: lambda n: compare_versions(n, "0.11.0") bma.tx.History: lambda n: compare_versions(n, "0.11.0")
......
...@@ -42,7 +42,7 @@ def async_exception_handler(loop, context): ...@@ -42,7 +42,7 @@ def async_exception_handler(loop, context):
logging.error('\n'.join(log_lines), exc_info=exc_info) logging.error('\n'.join(log_lines), exc_info=exc_info)
if "Unclosed" not in message and \ if "Unclosed" not in message and \
"gaierror(-2" not in message: "socket.gaierror" not in message:
os._exit(1) os._exit(1)
......
...@@ -48,6 +48,9 @@ class TestBmaAccess(unittest.TestCase): ...@@ -48,6 +48,9 @@ class TestBmaAccess(unittest.TestCase):
res = self.bma_access._compare_json({}, corrupted.bma_null_data) res = self.bma_access._compare_json({}, corrupted.bma_null_data)
self.assertFalse(res) self.assertFalse(res)
def test_filter_nodes(self):
pass#TODO
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr) logging.basicConfig(stream=sys.stderr)
logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment