Ejemplo n.º 1
0
 def __init__(self, cfg=None):
     if cfg is None:
         cfg = PaellaConfig('database')
     if type(cfg) is not dict:
         dsn = cfg.get_dsn()
     else:
         dsn = cfg
     if os.environ.has_key('PAELLA_DBHOST'):
         dsn['dbhost'] = os.environ['PAELLA_DBHOST']
     if os.environ.has_key('PAELLA_DBNAME'):
         dsn['dbname'] = os.environ['PAELLA_DBNAME']
     QuickConn.__init__(self, dsn)
Ejemplo n.º 2
0
 def __init__(self, cfg=None):
     if cfg is None:
         cfg = PaellaConfig('database')
     if type(cfg) is not dict:
         dsn = cfg.get_dsn()
     else:
         dsn = cfg
     if os.environ.has_key('PAELLA_DBHOST'):
         dsn['dbhost'] = os.environ['PAELLA_DBHOST']
     if os.environ.has_key('PAELLA_DBNAME'):
         dsn['dbname'] = os.environ['PAELLA_DBNAME']
     QuickConn.__init__(self, dsn)
Ejemplo n.º 3
0
def create_database(cfg, default_traits):
    dsn = cfg.get_dsn()
    dsn['dbname'] = 'mishmash'
    conn = QuickConn(dsn)
    cmd = StatementCursor(conn, 'create_database')
    for table in cmd.tables():
        cmd.execute('drop table %s' % table)
    start_schema(conn, default_traits)
    make_suites(conn)
    cmd.execute(grant_public(cmd.tables()))
    cmd.execute(grant_public(['current_environment'], 'ALL'))
Ejemplo n.º 4
0
            raise Error, 'too many %s sections' % section
        else:
            return sections

    def get_elements_from_section(self, element, section, tag, atts=[]):
        sections = self._get_single_section(element, section)
        if len(sections):
            return sections[0].getElementsByTagName(tag)
        else:
            return []

    def get_attribute(self, element, attribute):
        return element.getAttribute(attribute).encode()


if __name__ == '__main__':
    from paella.base.config import Configuration
    from paella.db.lowlevel import QuickConn
    from paella.db.midlevel import TableDict
    conn = QuickConn(g)
    e = TableDict(conn, 'woody_variables')

    x = XmlDoc()
    x.hello = x.insert(x.doc, 'hello')
    t = TextElement('person', 'hank')
    td = dict(foo='bar', a='a', b='sdf', dd='val')

    d = DictElement('foodict', e)
    rows = e.cursor.select()
    ss = parse_string(d.toxml())
Ejemplo n.º 5
0
                self.cmd.update(self.theme, states, "element = '%s'" % element)

    def __save_files__(self, *args):
        colordict = Rgbdb()
        tmpl = GtkrcTemplate(self.theme, theme_base, self.browser._style)
        tmpl.write_files()


if __name__ == '__main__':
    cd = Rgbdb()
    tp = os.path.expanduser(g['template_path'])
    fg, bg, base, text = {}, {}, {}, {}
    s = Style(cd)  #fg, bg, base, text)
    tmpl = GtkrcTemplate('test', theme_base, s)
    cd.set_plain(1)
    c = QuickConn()
    win = ColorThingyWindow(cd, c)
    t = NameTable('themes', ['theme'])
    cmd = CommandCursor(c, 'dsfsdf')

    def dtable():
        cmd.execute('drop table themebase')

    def dtables():
        for t in cmd.tables():
            if t not in ['footable']:
                cmd.execute('drop table %s' % t)

    #dtables()
    mainloop()
Ejemplo n.º 6
0
 def __init__(self, cfg=Configuration('repos')):
     QuickConn.__init__(self, cfg)
Ejemplo n.º 7
0
 def __init__(self, cfg=Configuration('repos')):
     QuickConn.__init__(self, cfg)
Ejemplo n.º 8
0
        cutable = Md5sumsTable(self._table('current'))
        mk_current_table(self.cmd, cutable, config.get_files())


if __name__ == '__main__':
    from paella.base.config import Configuration
    cfg = Configuration()
    Host = cfg['dbhost']
    Dbname = 'sysconfig'
    User = cfg['dbusername']
    Password = cfg['dbpassword']
    dsn = dict(dbhost=cfg['dbhost'],
               dbname='sysconfig',
               dbusername=cfg['dbusername'],
               dbpassword=cfg['dbpassword'])
    c = QuickConn(dsn)
    cmd = CommandCursor(c, 'dsfsdf')
    #cmd.execute('create table %s' %t)
    co = ConfigObject()

    #co.set_every_config()
    #at = Table('atable', available_columns)
    #st = Table('stable', status_columns)
    def dtable():
        cmd.execute('drop table ptable')

    def dtables():
        for t in cmd.tables():
            if t != 'footable':
                cmd.execute('drop table %s' % t)