Commit c270c60b authored by Jerome Mariette's avatar Jerome Mariette
Browse files

test if login exists when adding runs

parent 3f8ed702
......@@ -20,14 +20,24 @@ import os
import sys
import pickle
import datetime
import argparse
from jflow.workflow import Workflow
from jflow.parameter import Parameter, date
from ng6.t3MySQLdb import t3MySQLdb
from ng6.project import Project
from ng6.run import Run
def adminlogin(login):
t3mysql = t3MySQLdb()
try:
t3mysql.get_user_id(login)
return login
except:
raise argparse.ArgumentTypeError("Login '" + login + "' does not exists! Please provide a valid login!")
class NG6Workflow (Workflow):
"""
"""
......@@ -35,7 +45,7 @@ class NG6Workflow (Workflow):
def __init__(self, args={}, id=None, function= "process", parameters_section="parameters", add_run_params=True):
Workflow.__init__(self, args, id, function, parameters_section)
# admin login is required for all workflow
self.parameters.append(Parameter("admin_login", "Who is the project administrator", "--admin-login", required=True, type=str))
self.parameters.append(Parameter("admin_login", "Who is the project administrator", "--admin-login", required=True, type=adminlogin))
if add_run_params:
self.parameters.extend(self._add_run_parameters())
self.args = self._extend_and_format_args(self.parameters, args)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment