__init__.py 1.61 KB
Newer Older
1
2
#
# Copyright (C) 2012 INRA
3
#
4
5
6
7
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
8
#
9
10
11
12
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
13
#
14
15
16
17
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

Penom Nom's avatar
Penom Nom committed
18
from jflow.workflow import Workflow
Penom Nom's avatar
Penom Nom committed
19

20
from ng6.project import Project
21

Celine Noirot's avatar
Celine Noirot committed
22
from workflows.types import ng6adminlogin, uniqproject
Penom Nom's avatar
Penom Nom committed
23

Penom Nom's avatar
Penom Nom committed
24
class AddProject (Workflow):
Jerome Mariette's avatar
Jerome Mariette committed
25

Penom Nom's avatar
Penom Nom committed
26
27
    def get_description(self):
        return "Add a brand new project"
28

Penom Nom's avatar
Penom Nom committed
29
30
31
32
    def define_parameters(self, function="process"):
        self.add_parameter("admin_login", "The login of a ng6 administrator", required = True, type = ng6adminlogin)
        self.add_parameter("project_name", "Give a name to your project (has to be unique)", flag = "--name", required = True, type = uniqproject)
        self.add_parameter("project_description", "Give a description to your project", flag = "--description", required = True)
33
        self.add_parameter("space", "Where to store data", flag = "--space", default="default", type=ng6space)
34

35
    def process(self):
36
        project = Project(self.project_name, self.project_description, self.admin_login, None, self.space)
37
        self.metadata.append("project_id="+str(project.id))