def do (from_scratch): ''' load_environment({'backend' : 'sqlalchemy', 'sqlalchemy.url' : 'sqlite:///development.sqlite'}) ''' load_environment({'backend' : 'sqlalchemy', 'sqlalchemy.url' : 'mysql://*****:*****@localhost:3306/projecte', 'sqlalchemy.pool_size' : 10 , 'sqlalchemy.max_overflow' : 10 , 'sqlalchemy.pool_timeout' : 30}) create_objects(from_scratch) init_data(from_scratch) result = dt.get_field_data("Thread", "title" ) dt.create_compose_acc("title", "Board", "Board") print 'Thread size: %s' % result['size'] o=dal.object.Thread.all().fetch() '''o1=dal.object.Thread.all().fetch()''' keys=o.keys() for key in keys: print 'thread: %s' % o[key].title
def _load_pylons(config_file): from paste.deploy import appconfig from pylons import config import ConfigParser import os from config.environment import load_environment conf = appconfig('config:' + config_file) config = load_environment(conf.global_conf, conf.local_conf) return config
import cmdln # pylons project initialize from paste.deploy import appconfig from pylons import config from config.environment import load_environment conf = appconfig('config:development.ini', relative_to='.') load_environment(conf.global_conf, conf.local_conf) # loading models from bind_config_manager.model import Base, Session, Domain, Record class BindConfig(cmdln.Cmdln): name = "bcm" def do_domain_list(self, subcmd, opts, *args): domains = Session.query(Domain).all() for domain in domains: self._print_records(domain.type, domain.name) do_domain_list.__doc__ = "Display list of available domains." def do_domain_show(self, subcmd, opts, *args): domain = self._find_domain(args) if domain: print '\nDomain Information:' print '-------------------' self._print_records(domain.type, domain.name, domain.soa_nameserver, domain.admin_mailbox, domain.serial, domain.refresh_ttl, domain.retry_ttl, domain.expire_ttl, domain.minimum_ttl, domain.default_ttl ) print '\nDomain Records:' print '---------------' for record in domain.records:
def do (from_scratch): ''' load_environment({'backend' : 'sqlalchemy', 'sqlalchemy.url' : 'sqlite:///development.sqlite'}) ''' load_environment({'backend' : 'sqlalchemy', 'sqlalchemy.url' : 'mysql://*****:*****@localhost:3306/unitTest', 'sqlalchemy.pool_size' : 10 , 'sqlalchemy.max_overflow' : 10 , 'sqlalchemy.pool_timeout' : 30}) initData(from_scratch)