コード例 #1
0
ファイル: __init__.py プロジェクト: syslabcom/recensio.policy
def reset():
    try:
        host = sys.argv[1]
        user = sys.argv[2]
        passwd = sys.argv[3]
        additional_profiles = sys.argv[4:]
    except:
        pass
    br = Browser()
    br.mech_browser.set_handle_robots(False)
    br.open(sys.argv[1])
    base64string = base64.encodestring('%s:%s' % (user, passwd))[:-1]
    br.addHeader('Authorization', 'Basic %s' % base64string)
    br.reload()
    reloadProfiles(br, host, additional_profiles)
    resetCatalog(br, host)
コード例 #2
0
ファイル: __init__.py プロジェクト: syslabcom/recensio.policy
def createSite():
    profile = ['recensio.policy:default']
    try:
        host = sys.argv[1]
        user = sys.argv[2]
        passwd = sys.argv[3]
        profile = [sys.argv[4]]
    except:
        pass
    base64string = base64.encodestring('%s:%s' % (user, passwd))[:-1]
    br = Browser(sys.argv[1])
    print "Trying to create new plone site"
    br.addHeader('Authorization', 'Basic %s' % base64string)
    br.getControl('Create a new Plone site').click()
    br.getControl(name = 'site_id').value = 'recensio'
    br.getControl(name = 'extension_ids:list', index=2).value = profile
    br.getControl('Create Plone Site').click()
    print "Plone site created"