Exemplo n.º 1
0
#
# Connecting to the test database
# ---
#
# Remember that none of these actually connect to the database until
# you actually attempt a database interaction.
# 
import os

import pandokia.helpers.importer as i
tc = i.importer( 'test_config', os.environ['PDK_TOP']+'/config' )
config = tc.cfg

def get_db_access(dbname) :
    s = 'test_database_%s_enable'%dbname
    if not ( s in config ) or not config[s] :
        raise NotImplementedError("database %s not enabled in %s/config" % (dbname, os.environ['PDK_TOP']) )
    return config['test_database_%s'%dbname]

def mysql(clear) :
    import pandokia.db_mysqldb as dbx
    d = get_db_access('mysqldb')
    dbx = dbx.PandokiaDB( d )
    if clear :
        dbx.execute('drop table if exists test_table')
    return dbx

def sqlite(clear) :
    d = get_db_access('sqlite')
    import pandokia.db_sqlite as dbx
    if clear :
Exemplo n.º 2
0
# Copyright 2009, Association of Universities for Research in Astronomy (AURA)
#
"""
bug: put a doc string here
describe pandokia.helpers, pandokia.runners

describe pandokia a little
"""

import os
import sys
from .version import *

# A simple boolean check for python 3.0.0.final or greater
PY3 = bool(sys.hexversion >= 0x030000F)

# this looks a little strange, but we are contemplating support for
# multiple configurations; that would go here.
if 'PDK_CONFIG' in os.environ:
    import pandokia.helpers.importer as i
    cfg = i.importer('pandokia.config', os.environ['PDK_CONFIG'])
else:
    import pandokia.default_config as cfg

#
# some constants that need to be somewhere

# time_t of an event that never expires; make this bigger if you are
# still using this in 2030.
never_expires = 0x7fffffff
Exemplo n.º 3
0
##########
# import test configuration
import os
import pandokia.helpers.importer as i
tc = i.importer('test_config', os.environ['PDK_TOP'] + '/config')
config = tc.cfg

exec('import pandokia.db_%s as dbd' % tc.cfg['test_database'])

##########

pdk_db = dbd.PandokiaDB(tc.cfg['test_database_%s' % tc.cfg['test_database']])
user_list = []

# which users can see/operate the admin interfaces
admin_user_list = ('sienkiew', 'Nobody', )

# This link is included in email notices.
pdk_url = "https://www.example.com/pandokia/pdk.cgi"

# don't descend into these directories to find tests
exclude_dirs = (
    '.svn',
    '.subversion',
    'CVS',
)

debug = True

# server_maintenance = 'backing up database'
Exemplo n.º 4
0
"""
bug: put a doc string here
describe pandokia.helpers, pandokia.runners

describe pandokia a little
"""

import os
import sys
from .version import *


# A simple boolean check for python 3.0.0.final or greater
PY3 = bool(sys.hexversion >= 0x030000F)

# this looks a little strange, but we are contemplating support for
# multiple configurations; that would go here.
if 'PDK_CONFIG' in os.environ:
    import pandokia.helpers.importer as i
    cfg = i.importer('pandokia.config', os.environ['PDK_CONFIG'])
else:
    import pandokia.default_config as cfg

#
# some constants that need to be somewhere

# time_t of an event that never expires; make this bigger if you are
# still using this in 2030.
never_expires = 0x7fffffff