/
addPlumiSite
53 lines (43 loc) · 1.62 KB
/
addPlumiSite
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# We need to do that when IPython is installed
#try:
# import IPython
# IPython.Shell.IPShell(user_ns=locals()).mainloop(sys_exit=1)
# app = __IP.internal_ns['app']
#except:
# pass
from Testing import makerequest
from AccessControl.SecurityManagement import newSecurityManager
# we need to be authenticated
admin = app.acl_users.getUserById('admin')
# or whatever admin id you have
admin = admin.__of__(app.acl_users)
newSecurityManager(None, admin)
# ATDocument (front-page) needs a request :-(
app=makerequest.makerequest(app)
# here we go
from Products.CMFPlone.factory import addPloneSite
from sys import argv
from zope.component import getUtility
from plone.registry.interfaces import IRegistry
if len(argv) > 1:
site_id = argv[1]
else:
site_id = 'Plone'
if len(argv) > 2:
videoserver = argv[2]
else:
videoserver = 'newvideos.plumi.org'
extension_profiles = ('plonetheme.classic:default', 'plonetheme.sunburst:default', )
if not app.get(site_id,False):
addPloneSite(app, site_id, extension_ids=extension_profiles, setup_content=True)
app[site_id].portal_setup.runAllImportStepsFromProfile('profile-plumi.app:default')
if len(argv) < 4 or argv[3] == 'default':
app[site_id].portal_setup.runAllImportStepsFromProfile('profile-plumi.skin:default')
elif argv[3] == 'sunburst':
pass
registry = getUtility(IRegistry, context=app[site_id])
registry['collective.transcode.star.interfaces.ITranscodeSettings.daemon_address'] = (u'http://%s' % videoserver,)
import transaction
transaction.commit()
else:
print "Portal with id %s already exists. Moving along" % site_id