Added support for qtIdent, qtTypeIdent, qtLiteral for quoting the

inputs.

In order to do the proper quoting around the identifier, different type,
and literal, we introduced respective functions qtIdent, qtTypeIdent,
qtLiteral in psycopg2 driver. Also, introduced them as the Jinja's
custom filter for using it directly inside the templates.

Also, created an utility - generate_keywords.py in order to generate
keyword lists from the latest PostgreSQL installation.
This commit is contained in:
Ashesh Vashi
2016-01-02 14:54:01 +05:30
parent eb83d57c5a
commit 2aeae06882
5 changed files with 216 additions and 3 deletions

View File

@@ -104,6 +104,19 @@ class ServerModule(sg.ServerGroupPluginModule):
return scripts
def register(self, app, options, first_registration=False):
"""
Override the default register function to automagically register
sub-modules at once.
"""
if first_registration:
from pgadmin.utils.driver import get_driver
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
super(ServerModule, self).register(app, options, first_registration)
class ServerMenuItem(MenuItem):
def __init__(self, **kwargs):