Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[9d8474]: Allura / allura / command / create_neighborhood.py Maximize Restore History

Download this file

create_neighborhood.py    27 lines (23 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from . import base
from allura import model as M
from allura.lib import plugin
class CreateNeighborhoodCommand(base.Command):
min_args=3
max_args=None
usage = '<ini file> <neighborhood_shortname> <admin1> [<admin2>...]'
summary = 'Create a new neighborhood with the listed admins'
parser = base.Command.standard_parser(verbose=True)
def command(self):
self.basic_setup()
admins = [ M.User.by_username(un) for un in self.args[2:] ]
shortname = self.args[1]
n = M.Neighborhood(
name=shortname,
url_prefix='/' + shortname + '/',
features=dict(private_projects = False,
max_projects = 500,
css = 'none',
google_analytics = False))
project_reg = plugin.ProjectRegistrationProvider.get()
project_reg.register_neighborhood_project(n, admins)
print "WARNING! You must restart the webserver before you can use the new neighborhood."