diff --git a/web/pgadmin/browser/collection.py b/web/pgadmin/browser/collection.py index faa291096..c7d3fa76b 100644 --- a/web/pgadmin/browser/collection.py +++ b/web/pgadmin/browser/collection.py @@ -11,9 +11,9 @@ import six from abc import ABCMeta, abstractmethod from flask import url_for, render_template from flask.ext.babel import gettext -from pgadmin.browser.utils import PgAdminModule, PGChildModule +from pgadmin.utils import PgAdminModule +from pgadmin.browser.utils import PGChildModule from pgadmin.browser import BrowserPluginModule -from pgadmin.browser.utils import PGChildNodeView @six.add_metaclass(ABCMeta) class CollectionNodeModule(PgAdminModule, PGChildModule): @@ -25,11 +25,14 @@ class CollectionNodeModule(PgAdminModule, PGChildModule): def __init__(self, import_name, **kwargs): kwargs.setdefault("url_prefix", self.node_path) kwargs.setdefault("static_url_path", '/static') - super(CollectionNodeModule, self).__init__( - "NODE-%s" % self.node_type, - import_name, - **kwargs - ) + + PgAdminModule.__init__( + self, + "NODE-%s" % self.node_type, + import_name, + **kwargs + ) + PGChildModule.__init__(self) @property def jssnippets(self): diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py index 408003b14..ab2eecd3f 100644 --- a/web/pgadmin/browser/utils.py +++ b/web/pgadmin/browser/utils.py @@ -9,16 +9,14 @@ """Browser helper utilities""" -from abc import ABCMeta, abstractmethod, abstractproperty -from collections import OrderedDict +from abc import ABCMeta, abstractmethod import flask from flask.views import View, MethodViewType, with_metaclass from flask.ext.babel import gettext import six from config import PG_DEFAULT_DRIVER -from pgadmin.browser import PgAdminModule -from pgadmin.utils.ajax import make_json_response +from pgadmin.utils.ajax import make_json_response, precondition_required @six.add_metaclass(ABCMeta) class NodeAttr(object): @@ -34,7 +32,7 @@ class NodeAttr(object): pass -class PGChildModule: +class PGChildModule(object): """ class PGChildModule @@ -55,15 +53,14 @@ class PGChildModule: """ def __init__(self, *args, **kwargs): - self.min_ver = 1000000000 - self.max_ver = 0 + self.min_ver = 0 + self.max_ver = 1000000000 self.server_type = None - self.attributes = {} super(PGChildModule, self).__init__(*args, **kwargs) - def BackendSupported(self, mangaer, **kwargs): - sversion = getattr(mangaer, 'sversion', None) + def BackendSupported(self, manager, **kwargs): + sversion = getattr(manager, 'sversion', None) if (sversion is None or not isinstance(sversion, int)): return False @@ -85,33 +82,6 @@ class PGChildModule: def get_nodes(self, sid=None, **kwargs): pass - def AddAttr(self, attr): - assert(isinstance(attr, PGNodeAttr)) - - name = getattr(attr, 'name', None) - assert(name is not None and isinstance(name, str)) - assert(name not in self.attributes) - # TODO:: Check for naming convention - - min_ver = getattr(attr, 'min_ver', None) - assert(min_ver is None or isinstance(min_ver, int)) - - max_ver = getattr(attr, 'max_ver', None) - assert(max_ver is None or isinstance(max_ver, int)) - - self.attributes[name] = attr - - if max_ver is None: - self.max_ver = None - elif self.max_var is not None and self.max_ver < max_ver: - self.max_ver < max_ver - - if min_ver is None: - self.min_ver = None - elif self.min_ver is not None and self.min_ver > min_ver: - self.min_ver = min_ver - - class NodeView(with_metaclass(MethodViewType, View)): """ A PostgreSQL Object has so many operaions/functions apart from CRUD