Exemplo n.º 1
0
#   Path (relative to home) win which service-specific Python module resides.
_SERVICE_PYTHON_SUBDIR  = 'share/python' 

#   List of paths to be appended to sys.path if they exist.
_PATH_LIST = \
    [
    ]

#   Public class members

VERBOSE = 0                     # Verbosity level for sdg package

#   Initialize module logger.
#   NOTE: This is a top-level logger that does NOT propagate upward.
LOGGER = log.init_module_logger(top=True)

#####

def set_settings_module():
    '''
    Try to find settings module and set its Python path into the environment.
    '''

    #   Don't do anything if already set.
    if os.environ.get('DJANGO_SETTINGS_MODULE', None):
        return None

    #   If not service user, can't do anything. Developer has other 
    #   alternatives.
    if not is_service_user():
Exemplo n.º 2
0
Package of SDG Django-related functions.
'''

import inspect
import logging
import os
import sys

from django.conf import settings

import sdg

from sdg.log import StreamLog, init_module_logger

#   Initialize module logger.
_LOGGER = init_module_logger()

#   Used to check contents of PSGCONF_CLASS_NAME environment variable.
_DEVELOPMENT_CLASS_LIST = [ 'Development' ]

_PATH_PART_CONFIG       = 'var/config'
_PATH_PART_WEB          = 'public_html/https'

#####

def get_base():
    # _debug_outerframes(label='get_base')

    base_dir = os.environ.get('PROJECT_ROOT_DIRECTORY', '')

    if base_dir:
Exemplo n.º 3
0
import cStringIO
import ipaddr
import logging
import operator
import os
import sys
import types
import warnings

from ConfigParser import NoSectionError, SafeConfigParser

from sdg.attrdict import AttrDict
from sdg import log

#   Initialize module logger.
LOGGER = log.init_module_logger()

#_re_python_attr = re.compile('[a-z_][a-z0-9_]')

#####

def _validate_validator(validator):
    '''Validate that validator callback argument is proper type.'''

    if isinstance(validator, types.FunctionType):
        return

    raise TypeError('validator callback must be %s; got %s' % 
                    (str(types.FunctionType), str(validator)))

#####