def update(self): from zope.app.appsetup.product import getProductConfiguration config = getProductConfiguration('database') DSN = config['dsn'] if DSN.startswith('oracle://*****:*****@10.30.131.206/BGETest'): if hasattr(self.view, 'flash'): self.view.flash(u"Test - System", type="info") else: print self.view
def getAutostartServiceNames(): """get a list of services to start""" serviceNames = [] config = getProductConfiguration('lovely.remotetask') if config is not None: serviceNames = [name.strip() for name in config.get('autostart', '').split(',')] return serviceNames
def initFormatter(event): config = getProductConfiguration('zojax.formatter') if config is None: config = {} sm = getGlobalSiteManager() try: timezone = vocabulary.timezones.getTermByToken( config.get('timezone', u'US/Pacific')).value except LookupError: timezone = u'US/Pacific' IFormatterConfiglet['timezone'].default = timezone
def databaseOpened(event, productName='z3c.taskqueue'): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') storeDBReference(event) root_folder = getRootFolder(event) from zope.app.appsetup.product import getProductConfiguration configuration = getProductConfiguration(productName) startSpecifications = getStartSpecifications(configuration) for sitesIdentifier, servicesIdentifier in startSpecifications: sites = getSites(sitesIdentifier, root_folder) for site in sites: startOneService(site, servicesIdentifier)
def databaseOpened(event, productName='z3c.taskqueue'): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') storeDBReference(event) root_folder = getRootFolder(event) from zope.app.appsetup.product import getProductConfiguration configuration = getProductConfiguration(productName) startSpecifications = getStartSpecifications(configuration) for sitesIdentifier, servicesIdentifier in startSpecifications: sites = getSites(sitesIdentifier, root_folder) for site in sites: startOneService(site, servicesIdentifier)
def databaseOpened(event, productName='z3c.taskqueue'): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') storeDBReference(event) root_folder = getRootFolder(event) from zope.app.appsetup.product import getProductConfiguration configuration = getProductConfiguration(productName) startSpecifications = getStartSpecifications(configuration) for sitesIdentifier, servicesIdentifier in startSpecifications: startedAnything = False sites = getSites(sitesIdentifier, root_folder) for site in sites: if servicesIdentifier == '*': started = startAllServices(site, root_folder) else: started = startOneService(site, servicesIdentifier) startedAnything = startedAnything or started if sitesIdentifier == "*" and not startedAnything: msg = 'no services started by directive *@%s' log.warn(msg % servicesIdentifier)
def startLucene(event): config = getProductConfiguration('zojax.lucene') if config is None: return jython = config.get('jython', '/usr/bin/jython') sm = getGlobalSiteManager() for name, data in config.items(): data = [s.strip() for s in data.split(',')] if name.startswith('server'): lucene = LuceneServer(*data, **{'jython': jython}) elif name.startswith('client'): lucene = LuceneClient(*data) else: continue try: lucene.start() sm.registerUtility(lucene, ILucene, data[0]) except Exception, e: logging.getLogger('zojax.lucene').log(logging.WARNING, e)
# -*- coding: utf-8 -*- # Copyright (c) 2007-2011 NovaReto GmbH # [email protected] import os import grok from z3c.saconfig import EngineFactory, GloballyScopedSession from sqlalchemy import Table, MetaData from zope.app.appsetup.product import getProductConfiguration config = getProductConfiguration('database') DSN = config['dsn'] SCHEMA = config.get('schema', 'EDUCUSADAT') engine_factory = EngineFactory(DSN, echo=False) scoped_session = GloballyScopedSession() grok.global_utility(engine_factory, direct=True) grok.global_utility(scoped_session, direct=True) engine = engine_factory() metadata = MetaData(bind=engine) if os.environ.get('ADHOC_TEST') == "True": c1unf1aa = None c1prs1aa = None avika1aa = None zczve1aa = None zckto1aa = None z1vrs1aa = None z1vrs2aa = None
def from_product_config(): """Get the utility configured with data from the product config.""" config = getProductConfiguration('zeit.find') return Elasticsearch(config['elasticsearch-url'], config['elasticsearch-index'])
def __init__(self): config = getProductConfiguration('oauth2') self.verify_token = config.get('verify_token', False)
def token_endpoint(self): config = getProductConfiguration('oauth2') return config.get('token_endpoint', False)
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, version 3 of the # License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from zope.app.appsetup.product import getProductConfiguration config = getProductConfiguration('assembly-mobile') if config is None: config = {} def integerValue(name, default): value = config.get(name, None) if value == None: return default return int(value.strip()) def stringValue(name, default): return unicode(config.get(name, default).strip(), "utf-8") def booleanValue(name, default): value = config.get(name, None)
# -*- coding: utf-8 -*- # Copyright (c) 2007-2013 NovaReto GmbH # [email protected] import grok from fernlehrgang import log from z3c.saconfig import EngineFactory, GloballyScopedSession from zope.app.appsetup.product import getProductConfiguration config = getProductConfiguration('database') try: DSN = config['dsn'] except: DSN = "postgresql+psycopg2://flg:flg@localhost/flg" log(DSN) print DSN # FIX: engine_factory = EngineFactory(DSN, convert_unicode=True, encoding='utf-8', optimize_limits=True, echo=False) engine_factory = EngineFactory( DSN, convert_unicode=True, encoding='iso-8859-15', echo=False) scoped_session = GloballyScopedSession() grok.global_utility(engine_factory, direct=True) grok.global_utility(scoped_session, direct=True)
# -*- coding: utf-8 -*- import grok import json import time from base64 import b64encode, b64decode from datetime import datetime, timedelta from os import path, makedirs, chmod from urllib import quote_plus, unquote_plus from zope.pluggableauth import interfaces from zope.interface import implementer from zope.pluggableauth.factories import PrincipalInfo from Crypto.PublicKey import RSA from zope.app.appsetup.product import getProductConfiguration config = getProductConfiguration('keys') pubkey = config['pubkey'] privkey = config['privkey']
def grok_init(event): config = getProductConfiguration('setmanager') init_db(config) init_datashackle_core()
from datetime import datetime from zeam.form.layout import Form from invoiceuploader import interface from zope.interface import implementer from megrok.nozodb import ApplicationRoot from zeam.form.base import action, Fields from dolmen.forms.base import ApplicationForm from PyPDF2 import PdfFileReader, PdfFileWriter, PdfFileMerger from zope.app.appsetup.product import getProductConfiguration from uvc.tbskin.viewlets import FlashMessages from zeam.form.base.markers import NO_VALUE from ukhtheme.grok.viewlets import BGHeader logger = logging.getLogger('impageuploader') settings = getProductConfiguration('settings') grok.templatedir("templates") class BGHeader(BGHeader): def application_url(self): return u"http://www.ukh.de" @implementer(interface.IInvoiceUploader) class InvoiceUploader(ApplicationRoot): pass class FlashMessages(FlashMessages):
def __init__(self): config = getProductConfiguration('oauth2') self.verify_token = config.get('verify_token', False)