mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
PEP8 fixes for the pgAgent and Tables nodes (and subnodes). Fixes #3148
This commit is contained in:
committed by
Dave Page
parent
bcdb8eb275
commit
6753cd7334
@@ -55,7 +55,9 @@ class JobModule(CollectionNodeModule):
|
||||
|
||||
status, res = conn.execute_scalar("""
|
||||
SELECT
|
||||
has_table_privilege('pgagent.pga_job', 'INSERT, SELECT, UPDATE') has_priviledge
|
||||
has_table_privilege(
|
||||
'pgagent.pga_job', 'INSERT, SELECT, UPDATE'
|
||||
) has_priviledge
|
||||
WHERE EXISTS(
|
||||
SELECT has_schema_privilege('pgagent', 'USAGE')
|
||||
WHERE EXISTS(
|
||||
@@ -148,7 +150,11 @@ class JobView(PGChildNodeView):
|
||||
@wraps(f)
|
||||
def wrap(self, *args, **kwargs):
|
||||
|
||||
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
|
||||
self.manager = get_driver(
|
||||
PG_DEFAULT_DRIVER
|
||||
).connection_manager(
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection()
|
||||
|
||||
# Set the template path for the sql scripts.
|
||||
@@ -182,9 +188,8 @@ SELECT EXISTS(
|
||||
if jid is not None:
|
||||
if len(rset['rows']) != 1:
|
||||
return gone(
|
||||
errormsg=_(
|
||||
"Could not find the pgAgent job on the server."
|
||||
))
|
||||
errormsg=_("Could not find the pgAgent job on the server.")
|
||||
)
|
||||
return make_json_response(
|
||||
data=self.blueprint.generate_browser_node(
|
||||
rset['rows'][0]['jobid'],
|
||||
@@ -356,8 +361,8 @@ SELECT EXISTS(
|
||||
jid,
|
||||
sid,
|
||||
row['jobname'],
|
||||
icon="icon-pga_job" if row['jobenabled'] else
|
||||
"icon-pga_job-disabled"
|
||||
icon="icon-pga_job" if row['jobenabled']
|
||||
else "icon-pga_job-disabled"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -438,7 +443,6 @@ SELECT EXISTS(
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
|
||||
if len(res['rows']) == 0:
|
||||
return gone(
|
||||
_("Could not find the object on the server.")
|
||||
@@ -446,7 +450,7 @@ SELECT EXISTS(
|
||||
|
||||
row = res['rows'][0]
|
||||
|
||||
status, res= self.conn.execute_dict(
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'steps.sql']),
|
||||
jid=jid, conn=self.conn,
|
||||
@@ -478,7 +482,7 @@ SELECT EXISTS(
|
||||
'jexdate': schedule['jexdate'][idx],
|
||||
'jextime': schedule['jextime'][idx]
|
||||
})
|
||||
idx+=1
|
||||
idx += 1
|
||||
del schedule['jexid']
|
||||
del schedule['jexdate']
|
||||
del schedule['jextime']
|
||||
@@ -527,4 +531,5 @@ SELECT EXISTS(
|
||||
status=200
|
||||
)
|
||||
|
||||
|
||||
JobView.register_node_view(blueprint)
|
||||
|
||||
@@ -391,7 +391,6 @@ class JobScheduleView(PGChildNodeView):
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@check_precondition
|
||||
def update(self, gid, sid, jid, jscid):
|
||||
"""
|
||||
|
||||
@@ -464,18 +464,16 @@ define('pgadmin.node.pga_schedule', [
|
||||
this.errorModel.unset('jscstart');
|
||||
}
|
||||
|
||||
val = this.get('jscend');
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
msg = gettext('Please enter the end time.');
|
||||
this.errorModel.set('jscend', msg);
|
||||
errMsg = errMsg || msg;
|
||||
} else {
|
||||
this.errorModel.unset('jscend');
|
||||
}
|
||||
|
||||
// End time must be greater than Start time
|
||||
if(!errMsg) {
|
||||
val = this.get('jscend');
|
||||
// No further validation required if end date is not provided by
|
||||
// the user
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var start_time = this.get('jscstart'),
|
||||
end_time = this.get('jscend'),
|
||||
start_time_js = start_time.split(' '),
|
||||
|
||||
@@ -487,7 +487,6 @@ SELECT EXISTS(
|
||||
|
||||
return make_json_response(success=1)
|
||||
|
||||
|
||||
@check_precondition
|
||||
def msql(self, gid, sid, jid, jstid=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user