def triggerPloneImportFromRecensio(): trigger_url, trigger_user, trigger_pass = sys.argv[1:4] target_url, user, password = map(urllib.quote, sys.argv[4:7]) browser = Browser('%s?url=%s&user=%s&password=%s' % (trigger_url, target_url,\ user, password)) browser.getControl(name = '__ac_name').value = trigger_user browser.getControl(name = '__ac_password').value = trigger_pass browser.getControl('Anmelden').click()
def __call__(self, url, user, password): count = 0 browser = Browser(url) browser.getControl(name = '__ac_name').value = user browser.getControl(name = '__ac_password').value = password browser.getControl('Log in').click() objects = xmlrpclib.loads(browser.contents)[0][0] import_utility = IRecensioImport(self.context) for object in objects: path = object['path'] if import_utility.exists(path): raise Exception('Object already exists') else: self.add(object) count += 1 import_utility.add(path) return "Successfully imported %i items" % count
def updateTranslations(ignore): br = Browser('http://transifex.syslab.com') try: br.getControl(name='username').value = sys.argv[1] if len(sys.argv) < 3: import getpass br.getControl(name='password').value = getpass.getpass() else: br.getControl(name='password').value = sys.argv[2] except IndexError: print "Usage: %s [Your Transifex username] [Your Transifex password]" return 1 br.getControl('Sign in').click() for domain, url_tmpl in (('recensio', 'http://transifex.syslab.com/projects/p/recensio/resource/recensiopot/l/%s/download/'), ('plone', 'http://transifex.syslab.com/projects/p/recensio/resource/plonepot/l/%s/download/')): for lang in ('de', 'en', 'fr'): print "Getting %s for %s" % (domain, lang) br.open(url_tmpl % lang) file(pkg_resources.resource_filename(__name__, 'locales/%s/LC_MESSAGES/%s.po' % (lang, domain)), 'w').write(br.contents)
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"