type = getClass("mailing", "mailman") if not type: raise ScalakError("Mailman add: no such service type. Please contact" \ "Scalak administrator.") name = None if len(cl_args) > 1: name = cl_args[1] project.addService(type(name)) print "List added" def remove(self, project, cl_args, config): if len(cl_args) != 2: raise ScalakError("No list name specified") name = cl_args[1] srv = project.getService("mailing", "mailman", name) if not srv or len(srv) < 1: raise ScalakError("Mailman add: no such mailing list for given " \ "project") project.delService(srv[0]) print "List removed" common.registerCommand(MailmanCmd._command, MailmanCmd())
def add(self, project, cl_args, config): type = getClass("mailing", "mailman") if not type: raise ScalakError("Mailman add: no such service type. Please contact" \ "Scalak administrator.") name = None if len(cl_args) > 1: name = cl_args[1] project.addService(type(name)) print "List added" def remove(self, project, cl_args, config): if len(cl_args) != 2: raise ScalakError("No list name specified") name = cl_args[1] srv = project.getService("mailing", "mailman", name) if not srv or len(srv) < 1: raise ScalakError("Mailman add: no such mailing list for given " \ "project") project.delService(srv[0]) print "List removed" common.registerCommand(MailmanCmd._command, MailmanCmd())
type = getClass("repository", cl_args[1]) if not type: raise ScalakError("Repository add: no such repository type") name = None if len(cl_args) > 2: name = cl_args[2] project.addService(type(name)) print "Repository added" def remove(self, project, cl_args, config): if len(cl_args) < 3: raise ScalakError("Repository remove: You have to supply repository " \ "type and name") name = cl_args[2] type = cl_args[1] srv = project.getService("repository", type, name) if not srv: raise ScalakError("Repository add: no such repository for given " \ "project") project.delService(srv[0]) print "Repository removed" common.registerCommand(RepositoryCmd._command, RepositoryCmd())
return -1 return 0 def remove(self, project_name, config): p = Project() p.load(project_name, config) p.remove() def create(self, command, project_name, cl_args, config): args,loose = getopt.getopt(cl_args, 'b:d:e:') args = dict(args) if len(loose) < 1: raise ScalakError("Create Error: at last administrators id must be supplied") admin = loose[0] brief = args.get('-b', None) desc = args.get('-d', None) # TODO checking date format due = args.get('-e', None) today = datetime.date.today().isoformat() project = Project(config, project_name, admin, today, due, brief, desc) project.create() project.addService(Trac()) project.addUser(admin) common.registerCommand(ProjectCmd._command, ProjectCmd())
return 0 def add(self, project, cl_args, config): if len(cl_args) < 2: raise ScalakError("User add: You have to supply user id") id = cl_args[1] if not findUser(id): raise ScalakError("User add: user dosen't exists") project.addUser(id) print "User added" def remove(self, project, cl_args, config): if len(cl_args) < 2: raise ScalakError("User add: You have to supply user id") id = cl_args[1] if not findUser(id, project.id): raise ScalakError("User remove: user dosen't exists or not " \ "member of the project") project.removeUser(id) print "User removed" common.registerCommand(UserCmd._command, UserCmd())