1) Replace Flask-BabelEx with Flask-Babel. Fixes #6088

2) Upgrade Flask to version 2. Fixes #7010
This commit is contained in:
Akshay Joshi 2021-11-24 17:22:57 +05:30
parent 3a30f27153
commit d644b4f94e
120 changed files with 211 additions and 199 deletions

View File

@ -23,36 +23,35 @@ Python Dependencies
Name Version Licence URL
---- ------- ------- ---
Flask 1.1.4 BSD-3-Clause https://palletsprojects.com/p/flask/
Flask 2.0.2 BSD-3-Clause https://palletsprojects.com/p/flask
Flask-Gravatar 0.5.0 BSD https://github.com/zzzsochi/Flask-Gravatar/
Flask-Login 0.5.0 MIT https://github.com/maxcountryman/flask-login
Flask-Mail 0.9.1 BSD https://github.com/rduplain/flask-mail
Flask-Migrate 2.7.0 MIT http://github.com/miguelgrinberg/flask-migrate/
Flask-Migrate 3.1.0 UNKNOWN https://github.com/miguelgrinberg/flask-migrate
Flask-SQLAlchemy 2.5.1 BSD-3-Clause https://github.com/pallets/flask-sqlalchemy
Flask-WTF 0.15.1 BSD https://github.com/wtforms/flask-wtf
Flask-WTF 1.0.0 BSD-3-Clause https://github.com/wtforms/flask-wtf/
Flask-Compress 1.10.1 MIT https://github.com/colour-science/flask-compress
Flask-Paranoid 0.2.0 MIT http://github.com/miguelgrinberg/flask-paranoid/
Flask-Babel 2.0.0 BSD http://github.com/python-babel/flask-babel
Flask-Security-Too 4.1.2 MIT https://github.com/Flask-Middleware/flask-security
Flask-SocketIO 5.1.1 UNKNOWN https://github.com/miguelgrinberg/flask-socketio
WTForms 3.0.0 BSD-3-Clause https://wtforms.readthedocs.io/
passlib 1.7.4 BSD https://passlib.readthedocs.io
pytz 2021.3 MIT http://pythonhosted.org/pytz
simplejson 3.17.5 MIT License https://github.com/simplejson/simplejson
simplejson 3.17.6 MIT License https://github.com/simplejson/simplejson
six 1.16.0 MIT https://github.com/benjaminp/six
speaklater3 1.4 UNKNOWN https://github.com/ThomasWaldmann/speaklater
sqlparse 0.4.2 BSD-3-Clause https://github.com/andialbrecht/sqlparse
WTForms 2.3.3 BSD-3-Clause https://wtforms.readthedocs.io/
Flask-Paranoid 0.2.0 MIT http://github.com/miguelgrinberg/flask-paranoid/
psutil 5.8.0 BSD https://github.com/giampaolo/psutil
psycopg2 2.8.6 LGPL with exceptions https://psycopg.org/
python-dateutil 2.8.2 Dual License https://github.com/dateutil/dateutil
SQLAlchemy 1.3.24 MIT http://www.sqlalchemy.org
itsdangerous 1.1.0 BSD https://palletsprojects.com/p/itsdangerous/
Flask-Security-Too 4.1.2 MIT https://github.com/Flask-Middleware/flask-security
SQLAlchemy 1.4.27 MIT https://www.sqlalchemy.org
bcrypt 3.2.0 Apache License, Version 2.0 https://github.com/pyca/bcrypt/
cryptography 3.4.8 BSD or Apache License, Version 2.0 https://github.com/pyca/cryptography
sshtunnel 0.4.0 MIT https://github.com/pahaz/sshtunnel
ldap3 2.9.1 LGPL v3 https://github.com/cannatag/ldap3
Flask-BabelEx 0.9.4 BSD http://github.com/mrjoes/flask-babelex
gssapi 1.6.14 LICENSE.txt https://github.com/pythongssapi/python-gssapi
Flask-SocketIO 5.1.1 UNKNOWN https://github.com/miguelgrinberg/flask-socketio
eventlet 0.31.0 UNKNOWN http://eventlet.net
eventlet 0.33.0 UNKNOWN http://eventlet.net
httpagentparser 1.9.1 http://www.opensource.org/licenses/mit-license.php http://shon.github.com/httpagentparser
user-agents 2.2.0 MIT https://github.com/selwin/python-user-agents
pywinpty 1.1.1 Unknown Unknown
@ -62,7 +61,7 @@ requests 2.25.1
NOTE: This report was generated using Python 3.9. Full information may not be
shown for Python modules that are not required with this version.
35 dependencies listed.
34 dependencies listed.
Javascript Dependencies
=======================

View File

@ -13,7 +13,9 @@ New features
Housekeeping
************
| `Issue #6088 <https://redmine.postgresql.org/issues/6088>`_ - Replace Flask-BabelEx with Flask-Babel.
| `Issue #6984 <https://redmine.postgresql.org/issues/6984>`_ - Port Backup Global, Backup Server, and Backup object dialog in React.
| `Issue #7010 <https://redmine.postgresql.org/issues/7010>`_ - Upgrade Flask to version 2.
Bug fixes
*********
@ -23,4 +25,4 @@ Bug fixes
| `Issue #6986 <https://redmine.postgresql.org/issues/6986>`_ - Fixed an issue where the user can't debug function with timestamp parameter.
| `Issue #6989 <https://redmine.postgresql.org/issues/6989>`_ - Fixed an issue where the Change Password menu option is missing for internal authentication source when more than one authentication source is defined.
| `Issue #7006 <https://redmine.postgresql.org/issues/7006>`_ - Ensure that Python 3.10 and the latest eventlet dependency should not break the application.
| `Issue #7013 <https://redmine.postgresql.org/issues/7013>`_ - Fix an RPM build issue that could lead to a conflict with python3 at installation.
| `Issue #7013 <https://redmine.postgresql.org/issues/7013>`_ - Fix an RPM build issue that could lead to a conflict with python3 at installation.

View File

@ -8,35 +8,34 @@
#
###############################################################################
Flask==1.*
Flask==2.*
Flask-Gravatar==0.*
Flask-Login==0.*
Flask-Mail==0.*
Flask-Migrate==2.*
Flask-Migrate==3.*
Flask-SQLAlchemy==2.*
Flask-WTF==0.*
Flask-WTF==1.*
Flask-Compress==1.*
Flask-Paranoid==0.*
Flask-Babel==2.*
Flask-Security-Too==4.*
Flask-SocketIO>=5.0.1
WTForms==3.*
passlib==1.*
pytz==2021.*
simplejson==3.*
six==1.*
speaklater3==1.*
sqlparse==0.*
WTForms==2.*
Flask-Paranoid==0.*
psutil==5.*
psycopg2==2.8.*
python-dateutil==2.*
SQLAlchemy==1.3.*
itsdangerous<=1.1.0
Flask-Security-Too==4.*
SQLAlchemy==1.4.*
bcrypt==3.*
cryptography==3.*
sshtunnel==0.*
ldap3==2.*
Flask-BabelEx==0.*
gssapi==1.6.*
flask-socketio>=5.0.1
eventlet==0.33.0
httpagentparser==1.9.*
user-agents==2.2.0

View File

@ -209,8 +209,11 @@ def upgrade():
os.urandom(32)).decode()
db.engine.execute(sql)
sql = "INSERT INTO keys (name, value) VALUES ('SECRET_KEY', '%s')" % base64.urlsafe_b64encode(
os.urandom(32)).decode()
if hasattr(config, 'SECRET_KEY'):
sql = "INSERT INTO keys (name, value) VALUES ('SECRET_KEY', '%s')" % config.SECRET_KEY
else:
sql = "INSERT INTO keys (name, value) VALUES ('SECRET_KEY', '%s')" % base64.urlsafe_b64encode(
os.urandom(32)).decode()
db.engine.execute(sql)
# If SECURITY_PASSWORD_SALT is not in the config, but we're upgrading, then it must (unless the

View File

@ -22,7 +22,7 @@ import sqlalchemy as sa
from alembic import op
from flask import current_app
from flask_security import Security, SQLAlchemyUserDatastore
from flask_security.utils import encrypt_password
from flask_security.utils import hash_password
from pgadmin.model import db, User, Role
from pgadmin.setup import get_version
from pgadmin.setup import user_info
@ -116,14 +116,24 @@ VALUES(1, 1, 'Servers')
os.urandom(32)
).decode()
)
secret_key = getattr(
config, 'SECRET_KEY', base64.urlsafe_b64encode(
os.urandom(32)
).decode()
)
if current_app.extensions.get('security') is None:
current_app.config['SECURITY_PASSWORD_SALT'] = current_salt
current_app.config['SECRET_KEY'] = secret_key
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
Security(current_app, user_datastore, register_blueprint=False)
else:
current_app.config['SECURITY_PASSWORD_SALT'] = current_salt
current_app.config['SECRET_KEY'] = secret_key
setattr(config, 'SECURITY_PASSWORD_SALT', current_salt)
password = encrypt_password(password)
setattr(config, 'SECRET_KEY', secret_key)
password = hash_password(password)
db.engine.execute("""
INSERT INTO "user"

View File

@ -23,8 +23,8 @@ from importlib import import_module
from flask import Flask, abort, request, current_app, session, url_for
from flask_socketio import SocketIO
from werkzeug.exceptions import HTTPException
from flask_babelex import Babel, gettext
from flask_babelex import gettext as _
from flask_babel import Babel, gettext
from flask_babel import gettext as _
from flask_login import user_logged_in, user_logged_out
from flask_mail import Mail
from flask_paranoid import Paranoid
@ -78,17 +78,21 @@ class PgAdmin(Flask):
super(PgAdmin, self).__init__(*args, **kwargs)
def find_submodules(self, basemodule):
for module_name in find_modules(basemodule, True):
if module_name in self.config['MODULE_BLACKLIST']:
try:
for module_name in find_modules(basemodule, True):
if module_name in self.config['MODULE_BLACKLIST']:
self.logger.info(
'Skipping blacklisted module: %s' % module_name
)
continue
self.logger.info(
'Skipping blacklisted module: %s' % module_name
)
continue
self.logger.info('Examining potential module: %s' % module_name)
module = import_module(module_name)
for key in list(module.__dict__.keys()):
if isinstance(module.__dict__[key], PgAdminModule):
yield module.__dict__[key]
'Examining potential module: %s' % module_name)
module = import_module(module_name)
for key in list(module.__dict__.keys()):
if isinstance(module.__dict__[key], PgAdminModule):
yield module.__dict__[key]
except Exception as _:
return []
@property
def submodules(self):
@ -704,8 +708,9 @@ def create_app(app_name=None):
##########################################################################
for module in app.find_submodules('pgadmin'):
app.logger.info('Registering blueprint module: %s' % module)
app.register_blueprint(module)
app.register_logout_hook(module)
if app.blueprints.get(module.name) is None:
app.register_blueprint(module)
app.register_logout_hook(module)
@app.before_request
def limit_host_addr():

View File

@ -11,7 +11,7 @@
import sys
from flask import Response, render_template, __version__, url_for, request
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import current_user, login_required
from pgadmin.utils import PgAdminModule
from pgadmin.utils.menu import MenuItem

View File

@ -14,7 +14,7 @@ import copy
from flask import current_app, flash, Response, request, url_for, \
session, redirect
from flask_babelex import gettext
from flask_babel import gettext
from flask_security.views import _security
from flask_security.utils import get_post_logout_redirect, \
get_post_login_redirect, logout_user

View File

@ -13,7 +13,7 @@ import six
from flask import current_app, flash
from flask_security import login_user
from abc import abstractmethod, abstractproperty
from flask_babelex import gettext
from flask_babel import gettext
from .registry import AuthSourceRegistry
from pgadmin.model import User

View File

@ -13,7 +13,7 @@ import base64
from os import environ, path, remove
from werkzeug.datastructures import Headers, MultiDict
from flask_babelex import gettext
from flask_babel import gettext
from flask import request, Response, session,\
current_app, render_template, flash, url_for
from flask_security.views import _security
@ -53,10 +53,10 @@ if config.KRB_KTNAME and config.KRB_KTNAME != '<KRB5_KEYTAB_FILE>':
class KerberosModule(PgAdminModule):
def register(self, app, options, first_registration=False):
def register(self, app, options):
# Do not look for the sub_modules,
# instead call blueprint.register(...) directly
super(PgAdminModule, self).register(app, options, first_registration)
super(PgAdminModule, self).register(app, options)
def get_exposed_url_endpoints(self):
return ['kerberos.login',

View File

@ -16,7 +16,7 @@ from ldap3 import Connection, Server, Tls, ALL, ALL_ATTRIBUTES, ANONYMOUS,\
from ldap3.core.exceptions import LDAPSocketOpenError, LDAPBindError,\
LDAPInvalidScopeError, LDAPAttributeError, LDAPInvalidFilterError,\
LDAPStartTLSError, LDAPSSLConfigurationError
from flask_babelex import gettext
from flask_babel import gettext
from urllib.parse import urlparse
from .internal import BaseAuthentication

View File

@ -14,7 +14,7 @@ import config
from authlib.integrations.flask_client import OAuth
from flask import current_app, url_for, session, request,\
redirect, Flask, flash
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_user, current_user
from flask_security.utils import get_post_logout_redirect, \
get_post_login_redirect, logout_user
@ -32,10 +32,10 @@ OAUTH2_AUTHORIZE = 'oauth2.authorize'
class Oauth2Module(PgAdminModule):
def register(self, app, options, first_registration=False):
def register(self, app, options):
# Do not look for the sub_modules,
# instead call blueprint.register(...) directly
super(PgAdminModule, self).register(app, options, first_registration)
super(PgAdminModule, self).register(app, options)
def get_exposed_url_endpoints(self):
return [OAUTH2_AUTHORIZE,

View File

@ -14,7 +14,7 @@ import string
import config
from flask import request, current_app, session, Response, render_template, \
url_for
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_user
from .internal import BaseAuthentication
from pgadmin.model import User
@ -27,10 +27,10 @@ from os import environ, path, remove
class WebserverModule(PgAdminModule):
def register(self, app, options, first_registration=False):
def register(self, app, options):
# Do not look for the sub_modules,
# instead call blueprint.register(...) directly
super(PgAdminModule, self).register(app, options, first_registration)
super(PgAdminModule, self).register(app, options)
def get_exposed_url_endpoints(self):
return ['webserver.login',

View File

@ -22,7 +22,7 @@ import six
import time
from flask import current_app, render_template, url_for, make_response, \
flash, Response, request, after_this_request, redirect, session
from flask_babelex import gettext
from flask_babel import gettext
from flask_gravatar import Gravatar
from flask_login import current_user, login_required
from flask_security.changeable import change_user_password

View File

@ -11,7 +11,7 @@ from abc import ABCMeta, abstractmethod
import six
from flask import url_for, render_template
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser import BrowserPluginModule
from pgadmin.browser.utils import PGChildModule
from pgadmin.utils import PgAdminModule

View File

@ -7,7 +7,7 @@
#
##########################################################################
import sys
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.utils.constants import PREF_LABEL_DISPLAY,\
PREF_LABEL_KEYBOARD_SHORTCUTS, PREF_LABEL_TABS_SETTINGS, \
PREF_LABEL_OPTIONS, QT_DEFAULT_PLACEHOLDER

View File

@ -14,7 +14,7 @@ from abc import ABCMeta, abstractmethod
import six
from flask import request, jsonify, render_template
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import current_user, login_required
from pgadmin.browser import BrowserPluginModule
from pgadmin.browser.utils import NodeView

View File

@ -11,7 +11,7 @@ import simplejson as json
import pgadmin.browser.server_groups as sg
from flask import render_template, request, make_response, jsonify, \
current_app, url_for, session
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import current_user, login_required
from pgadmin.browser.server_groups.servers.types import ServerType
from pgadmin.browser.utils import PGChildNodeView
@ -302,19 +302,18 @@ class ServerModule(sg.ServerGroupPluginModule):
return scripts
def register(self, app, options, first_registration=False):
def register(self, app, options):
"""
Override the default register function to automagically register
sub-modules at once.
"""
if first_registration:
driver = get_driver(PG_DEFAULT_DRIVER, app)
app.jinja_env.filters['qtLiteral'] = driver.qtLiteral
app.jinja_env.filters['qtIdent'] = driver.qtIdent
app.jinja_env.filters['qtTypeIdent'] = driver.qtTypeIdent
app.jinja_env.filters['hasAny'] = has_any
driver = get_driver(PG_DEFAULT_DRIVER, app)
app.jinja_env.filters['qtLiteral'] = driver.qtLiteral
app.jinja_env.filters['qtIdent'] = driver.qtIdent
app.jinja_env.filters['qtTypeIdent'] = driver.qtTypeIdent
app.jinja_env.filters['hasAny'] = has_any
super(ServerModule, self).register(app, options, first_registration)
super(ServerModule, self).register(app, options)
# We do not have any preferences for server node.
def register_preferences(self):

View File

@ -14,7 +14,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, current_app, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import current_user
import pgadmin.browser.server_groups.servers as servers

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -13,7 +13,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, \

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
parse_priv_to_db, validate_options, tokenize_options

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
parse_priv_to_db, validate_options, tokenize_options

View File

@ -16,7 +16,7 @@ import pgadmin.browser.server_groups.servers as servers
from pgadmin.browser.server_groups.servers.utils import \
validate_options, tokenize_options
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
parse_priv_to_db

View File

@ -13,7 +13,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -12,7 +12,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers as servers
from config import PG_DEFAULT_DRIVER

View File

@ -12,7 +12,7 @@
from functools import wraps
from flask import render_template
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -12,7 +12,7 @@
from functools import wraps
from flask import render_template
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -12,7 +12,7 @@
from functools import wraps
from flask import render_template
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -14,7 +14,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases.schemas.domains \
as domains

View File

@ -16,7 +16,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, request, jsonify, \
current_app
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, current_app, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, current_app, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext as _
from flask_babel import gettext as _
from config import PG_DEFAULT_DRIVER
from pgadmin.browser.server_groups.servers.databases import DatabaseModule

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from config import PG_DEFAULT_DRIVER
from pgadmin.browser.server_groups.servers.databases import DatabaseModule

View File

@ -18,7 +18,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify, \
current_app
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -12,7 +12,7 @@
from functools import wraps
from flask import render_template
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -14,7 +14,7 @@ import re
from functools import wraps
from flask import render_template, make_response
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases\
.schemas.packages as packages

View File

@ -12,7 +12,7 @@
from functools import wraps
from flask import render_template, make_response
from flask_babelex import gettext
from flask_babel import gettext
import pgadmin.browser.server_groups.servers.databases.schemas \
.packages as packages

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
import pgadmin.browser.server_groups.servers.databases as database
from config import PG_DEFAULT_DRIVER

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
import SchemaChildModule
from pgadmin.browser.utils import PGChildNodeView

View File

@ -14,7 +14,7 @@ import re
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify, url_for, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
import SchemaChildModule, DataTypeReader, VacuumSettings
from pgadmin.browser.server_groups.servers.utils import parse_priv_to_db

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
import DataTypeReader

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Compound Triggers. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ExecuteError
from pgadmin.browser.server_groups.servers.databases.schemas.utils \

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Compound Triggers. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from pgadmin.browser.server_groups.servers.databases.schemas.utils \

View File

@ -15,7 +15,7 @@ from functools import wraps
from pgadmin.utils.driver import get_driver
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, make_response
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, internal_server_error

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
constraints.type import ConstraintRegistry

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Check Constraint. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
constraints.type import ConstraintRegistry, ConstraintTypeModule
from pgadmin.browser.utils import PGChildNodeView

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Exclusion Constraint. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
constraints.type import ConstraintRegistry, ConstraintTypeModule
from pgadmin.browser.utils import PGChildNodeView

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Foreign Keys. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
constraints.type import ConstraintRegistry, ConstraintTypeModule
from pgadmin.browser.utils import PGChildNodeView

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Index Constraint. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
partitions import backend_supported

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Indexes. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -14,7 +14,7 @@ import random
import simplejson as json
import pgadmin.browser.server_groups.servers.databases.schemas as schema
from flask import render_template, request, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
import DataTypeReader, VacuumSettings
from pgadmin.utils.ajax import internal_server_error, \
@ -116,34 +116,28 @@ class PartitionsModule(CollectionNodeModule):
"""
return backend_supported(self, manager, **kwargs)
def register(self, app, options, first_registration=False):
def register(self, app, options):
"""
Override the default register function to automatically register
sub-modules of table node under partition table node.
"""
if first_registration:
self.submodules = list(app.find_submodules(self.import_name))
super(CollectionNodeModule, self).register(
app, options, first_registration
)
self.submodules = list(app.find_submodules(self.import_name))
super(CollectionNodeModule, self).register(app, options)
for module in self.submodules:
if first_registration:
module.parentmodules.append(self)
module.parentmodules.append(self)
app.register_blueprint(module)
# Now add sub modules of table node to partition table node.
if first_registration:
# Exclude 'partition' module for now to avoid cyclic import issue.
modules_to_skip = ['partition', 'column']
for parent in self.parentmodules:
if parent.node_type == 'table':
self.submodules += [
submodule for submodule in parent.submodules
if submodule.node_type not in modules_to_skip
]
# Exclude 'partition' module for now to avoid cyclic import issue.
modules_to_skip = ['partition', 'column']
for parent in self.parentmodules:
if parent.node_type == 'table':
self.submodules += [
submodule for submodule in parent.submodules
if submodule.node_type not in modules_to_skip
]
@property
def module_use_template_javascript(self):

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -10,7 +10,7 @@
""" Implements Utility class for row level security. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from functools import wraps

View File

@ -15,7 +15,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases.schemas as schemas
from flask import render_template, make_response, request, jsonify,\
current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.databases.schemas.utils import \
parse_rule_definition

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as database
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -10,7 +10,7 @@
""" Implements Utility class for Triggers. """
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.ajax import internal_server_error
from pgadmin.utils.exception import ObjectGone, ExecuteError
from pgadmin.browser.server_groups.servers.databases.schemas.utils \

View File

@ -14,7 +14,7 @@ import copy
from functools import wraps
import simplejson as json
from flask import render_template, jsonify, request
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.databases.schemas\
.tables.base_partition_table import BasePartitionTable

View File

@ -13,7 +13,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
import re
import pgadmin.browser.server_groups.servers.databases as database

View File

@ -15,7 +15,7 @@ from functools import wraps
import simplejson as json
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import current_user
import pgadmin.browser.server_groups.servers.databases as databases
from config import PG_DEFAULT_DRIVER

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers.databases as databases
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \

View File

@ -13,7 +13,7 @@ import simplejson as json
from datetime import datetime, time
from flask import render_template, request, jsonify
from flask_babelex import gettext as _
from flask_babel import gettext as _
from config import PG_DEFAULT_DRIVER

View File

@ -13,7 +13,7 @@ import simplejson as json
from functools import wraps
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, gone, \

View File

@ -13,7 +13,7 @@ import simplejson as json
from functools import wraps
from flask import render_template, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, gone, \

View File

@ -7,7 +7,7 @@
#
##########################################################################
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.server_groups.servers.types import ServerType

View File

@ -14,7 +14,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers as servers
from flask import render_template, make_response, request, jsonify
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import NodeView
from pgadmin.utils.ajax import make_json_response, \

View File

@ -12,7 +12,7 @@ from functools import wraps
import pgadmin.browser.server_groups as sg
import simplejson as json
from flask import render_template, request, jsonify, current_app
from flask_babelex import gettext as _
from flask_babel import gettext as _
import dateutil.parser as dateutil_parser
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.utils import PGChildNodeView
@ -23,7 +23,7 @@ from pgadmin.utils.driver import get_driver
from pgadmin.utils.constants import ERROR_FETCHING_ROLE_INFORMATION
from config import PG_DEFAULT_DRIVER
from flask_babelex import gettext
from flask_babel import gettext
_REASSIGN_OWN_SQL = 'reassign_own.sql'

View File

@ -12,7 +12,7 @@ from functools import wraps
import pgadmin.browser.server_groups.servers as servers
from flask import render_template, make_response, request, jsonify, current_app
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.browser.collection import CollectionNodeModule
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
parse_priv_to_db

View File

@ -13,7 +13,7 @@ import config
import copy
from flask import render_template
from flask_babelex import gettext as _
from flask_babel import gettext as _
from pgadmin.utils.preferences import Preferences
from werkzeug.exceptions import InternalServerError
from pgadmin.utils.constants import BINARY_PATHS

View File

@ -13,8 +13,8 @@ from abc import abstractmethod
import flask
from flask import render_template, current_app
from flask.views import View, MethodViewType, with_metaclass
from flask_babelex import gettext
from flask.views import View, MethodViewType
from flask_babel import gettext
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.ajax import make_json_response, precondition_required,\
@ -139,7 +139,7 @@ class PGChildModule(object):
pass
class NodeView(with_metaclass(MethodViewType, View)):
class NodeView(View, metaclass=MethodViewType):
"""
A PostgreSQL Object has so many operaions/functions apart from CRUD
(Create, Read, Update, Delete):

View File

@ -11,7 +11,7 @@
import math
from functools import wraps
from flask import render_template, url_for, Response, g, request
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required
import simplejson as json
from pgadmin.utils import PgAdminModule

View File

@ -9,7 +9,7 @@
"""A blueprint module implementing the pgAdmin help system."""
from flask import url_for
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.utils import PgAdminModule
from pgadmin.utils.menu import MenuItem, Panel
from pgadmin.utils.preferences import Preferences

View File

@ -11,7 +11,7 @@
import pgadmin.utils.driver as driver
from flask import url_for, render_template, Response, request
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.utils import PgAdminModule, replace_binary_path
from pgadmin.utils.csrf import pgCSRFProtect
from pgadmin.utils.session import cleanup_session_files

View File

@ -29,7 +29,7 @@ from pgadmin.utils.constants import KERBEROS
import pytz
from dateutil import parser
from flask import current_app, session
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import current_user
import config

View File

@ -24,7 +24,7 @@ from werkzeug.exceptions import InternalServerError
import simplejson as json
from flask import render_template, Response, session, request as req, \
url_for, current_app, send_from_directory
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required
from pgadmin.utils import PgAdminModule
from pgadmin.utils import get_storage_directory

View File

@ -15,7 +15,7 @@ side and for getting/setting preferences.
import config
import simplejson as json
from flask import render_template, url_for, Response, request, session
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import success_return, \

View File

@ -13,7 +13,7 @@ import traceback
import json
from flask import Response, request, render_template, url_for, current_app
from flask_babelex import gettext
from flask_babel import gettext
from flask_login import current_user
from flask_security import login_required
from pgadmin.utils import PgAdminModule

View File

@ -11,7 +11,7 @@
from flask import render_template, Response
from flask import url_for
from flask_babelex import Domain, gettext
from flask_babel import Domain, gettext
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import bad_request

View File

@ -16,7 +16,7 @@ import operator
from flask import render_template, request, current_app, \
url_for, Response
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \

View File

@ -17,7 +17,7 @@ from threading import Lock
from flask import Response, url_for, session, request, make_response
from werkzeug.useragents import UserAgent
from flask import current_app as app, render_template
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required, current_user
from pgadmin.tools.sqleditor.command import ObjectRegistry, SQLFilter
from pgadmin.tools.sqleditor import check_transaction_status

View File

@ -15,7 +15,7 @@ import re
from flask import url_for, Response, render_template, request, \
current_app
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required
from werkzeug.useragents import UserAgent

View File

@ -13,7 +13,7 @@ import simplejson as json
from flask import url_for, request
from flask import render_template, current_app as app
from flask_security import login_required
from flask_babelex import gettext
from flask_babel import gettext
from werkzeug.useragents import UserAgent
from pgadmin.utils import PgAdminModule, \
SHORTCUT_FIELDS as shortcut_fields

View File

@ -12,7 +12,7 @@
import simplejson as json
from flask import Response, url_for
from flask import render_template, request, current_app
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required
from urllib.parse import unquote

View File

@ -13,7 +13,7 @@ import simplejson as json
import os
from flask import url_for, Response, render_template, request, current_app
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \

View File

@ -12,7 +12,7 @@
import simplejson as json
from flask import url_for, Response, render_template, request, current_app
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, html, does_utility_exist, get_server

View File

@ -18,7 +18,7 @@ from config import PG_DEFAULT_DRIVER
from flask import Response, url_for, request
from flask import render_template, copy_current_request_context, \
current_app as app
from flask_babelex import gettext
from flask_babel import gettext
from flask_security import login_required, current_user
from pgadmin.browser.utils import underscore_unescape, underscore_escape
from pgadmin.utils import PgAdminModule

View File

@ -14,7 +14,7 @@ import os
from flask import render_template, request, current_app, \
url_for, Response
from flask_babelex import gettext as _
from flask_babel import gettext as _
from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \

View File

@ -16,7 +16,7 @@ import copy
from flask import Response, session, url_for, request
from flask import render_template, current_app as app
from flask_security import current_user, login_required
from flask_babelex import gettext
from flask_babel import gettext
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import make_json_response, bad_request, \
make_response as ajax_response, internal_server_error

View File

@ -7,7 +7,7 @@
#
##########################################################################
from flask_babelex import gettext
from flask_babel import gettext
class SchemaDiffModel(object):

Some files were not shown because too many files have changed in this diff Show More