コード例 #1
0
    def get_db_prep_save(self, value):
        """Convert our JSON object to a string before we save"""

        if value == "":
            return None

        if isinstance(value, dict) or isinstance(value, list):
            value = json.dumps(value, cls=DjangoJSONEncoder)
        elif value is not None:
            logger.warn('incorrect json value %s' % value)

        return super(JsonField, self).get_db_prep_save(value)
コード例 #2
0
"""

# lots of constants and other names
from itertools import *
from trackutil import *
from genetrack import logger
from StringIO import StringIO

import pychartdir

# load and set the chartdirector license
CHARTDIRECTOR_LICENSE = os.getenv('CHARTDIRECTOR_LICENSE', '')
if CHARTDIRECTOR_LICENSE:
    pychartdir.setLicenseCode( CHARTDIRECTOR_LICENSE ) 
else:
    logger.warn('chartdirector license not found')
    
# a few handy constants
TRANSPARENT  = pychartdir.Transparent
TOPCENTER    = pychartdir.TopCenter
NOVALUE      = pychartdir.NoValue
CIRCLESYMBOL = pychartdir.CircleSymbol
CROSS        = pychartdir.CrossShape(0.1)
CENTER       = pychartdir.Center
PNG          = pychartdir.PNG

# a few default colors

BLACK, RED, GREY = COLORS.BLACK, COLORS.RED, COLORS.GREY

def save(chart, fname):
コード例 #3
0
ファイル: main.py プロジェクト: pombredanne/genetrack-central
"""
Main index and non authenticated views
"""
import sys
from django.conf import settings
from genetrack import logger
from genetrack.server.web import html, authorize
from django.template import RequestContext

if not settings.DEBUG:
    logger.warn('debug mode is on')

def index(request):
    "Main index page"
    params = html.Params()
    params.project_count = authorize.project_count(request.user)
    return html.template( request, name='index.html', params=params )

def todo(request):
    "Todo page"
    params = html.Params(info='**test**')
    return html.template( request, name='todo.html', params=params )

def error500(request):
    "Server error page when debug flag is False"
    context = RequestContext(request)
    exc_type, exc_value, tb = sys.exc_info()
    logger.error(exc_value)
    return html.template( request, name='500.html', debug=exc_value )