# Django settings for pycon project.
from dbsettings import *
from bebop.config.base import app_configs_from_global_settings

DEBUG = False
TEMPLATE_DEBUG = False
#TEMPLATE_STRING_IF_INVALID = '[TEMPLATE_ERROR]'

CONFERENCE_NAME = 'PyCon 2008'
DATE_FORMAT = "D, j M Y H:i:s O"

USE_ETAGS = True

SERVER_EMAIL = 'webmaster@us.pycon.org'
ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
    ('Jeff Rush',      'jeff@taupro.com'),
    ('Doug Napoleone', 'pycon08-django@dougma.com'),
    ('PyCon-Tech',     'pycon-tech@python.org'),
)

MANAGERS = (
    ('PyCon', 'pycon@python.org'),
    )

DEFAULT_FROM_EMAIL =     'webmaster@us.pycon.org'
USERMGR_FROM_EMAIL =     'webmaster@us.pycon.org'
USERMGR_REPLYTO_EMAIL =  'pycon@python.org'
PROPMGR_FROM_EMAIL =     'webmaster@us.pycon.org'
PROPMGR_REPLYTO_EMAIL =  'pycon-pc@python.org'
SCHEDULE_FROM_EMAIL =    'webmaster@us.pycon.org'
SCHEDULE_REPLYTO_EMAIL = 'pycon@python.org'
MAILER_FROM_EMAIL =      'webmaster@us.pycon.org'
MAILER_REPLY_TO_EMAIL =  'pycon@python.org'

SCHEDULE_CHAIR_NOTIFY = ['goodger@python.org']

PROPMGR_STATS_EMAIL_TO = [
    'pycon-organizers@python.org',
    'pycon-pc@python.org']

ATTREG_INVOICE_FROM_EMAIL    = 'webmaster@us.pycon.org'
ATTREG_INVOICE_REPLYTO_EMAIL = 'pycon-reg@python.org'
ATTREG_INVOICE_CC            = ['psf-donations@python.org',
                                'pycon-reg@python.org',]
## change requests
ATTREG_REQUEST_FROM_EMAIL    = 'webmaster@us.pycon.org'
ATTREG_REQUEST_REPLYTO_EMAIL = 'pycon-reg@python.org'
ATTREG_REQUEST_CC            = ['psf-donations@python.org',
                                'pycon-reg@python.org',
                                'pycon@amk.ca',]
## 2nd and 3rd and corporate registrations
ATTREG_REG_FROM_EMAIL        = 'webmaster@us.pycon.org'
ATTREG_REG_REPLYTO_EMAIL     = 'pycon-reg@python.org'
ATTREG_REG_CC                = ['pycon-reg@python.org',]

## attendee listing automated e-mail
ATTREG_LISTING_FROM_EMAIL        = 'webmaster@us.pycon.org'
ATTREG_LISTING_REPLYTO_EMAIL     = 'pycon-reg@python.org'
ATTREG_LISTING_TO                = ['pycon-organizers@python.org',
                                    'pycon-reg@python.org',]

## optional thank-you page
ATTREG_THANKYOU_URL          = '/2008/registration/new/thank-you/'
## should be set to the donation thankyou url at python.org
ATTREG_ALT_THANKYOU_URL      = 'http://www.python.org/psf/donations/'


JOBBOARD__JOBS_ON_INDEX = 5
JOBBOARD__JOBS_PER_PAGE = 10
JOBBOARD__APPLICANTS_ON_INDEX = 5
JOBBOARD__APPLICANTS_PER_PAGE = 10
JOBBOARD__POSTS_EXPIRE_DAYS = 60
JOBBOARD__FROM_EMAIL = 'webmaster@us.pycon.org'



#DEFAULT_CHARSET defaults to utf8 which is what we want.
DEFAULT_EMAIL_CHARSET = 'us-ascii' # custom pycon extension.

# Local time zone for this installation. All choices can be found here:
# http://www.postgresql.org/docs/current/static/datetime-keywords.html
#                                                  #DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# Absolute URL to the Zope Talk Archive.
ZOPE_ARCHIVE_URL = '/zope/talks/'
ZOPE_TALKLINK_SEARCH = ZOPE_ARCHIVE_URL + 'talkLocate?year=2008&id='

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/var/hostings/05pcon0912/us.pycon.org/common/2008/'

RELEASE_FORM_PATH = MEDIA_ROOT + 'talkdata/PyCon2008/Releases/'

PROPOSAL_UPLOAD_TO = 'talkdata/PyCon2008/public/'
SPONSORSHIP_UPLOAD_TO = 'talkdata/PyCon2008/logos/'
EVENT_UPLOAD_TO = 'talkdata/PyCon2008/'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = 'http://us.pycon.org/common/2008/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = 'http://us.pycon.org/common/2008/admin/'


# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.core.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    ##"django.middleware.cache.CacheMiddleware", ## breaks tooo much
    'pycon.middleware.xstats.XStatsMiddleware', ## requires features app
    'django.middleware.gzip.GZipMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.http.ConditionalGetMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
    'django.middleware.transaction.TransactionMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    #"django.core.context_processors.i18n",
    "pycon.core.context_processors.request",
    "pycon.core.context_processors.settings",
    "pycon.navbar.context_processors.crumbs",
    "pycon.navbar.context_processors.navbars",
)

ROOT_URL     = '/2008/'
LOGIN_URL    = ROOT_URL + 'login/'
LOGOUT_URL   = ROOT_URL + 'logout/'
ADMIN_URL    = ROOT_URL + 'admin/'
PROFILE_URL  = ROOT_URL + 'profile/'
ROOT_URLCONF = 'website.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates".
    # Always use forward slashes, even on Windows.
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'django.contrib.humanize',
    'django.contrib.webdesign',
    'tagging',
    'website',
    'pycon',
    'pycon.navbar',
    'pycon.feedutil',
    'pycon.restructuredtext',
    'pycon.features',
    'pycon.usermgr',
    'pycon.propmgr',
    'pycon.mailer',
    'pycon.survey',
    'pycon.sponsorship',
    'pycon.cachemgr',
    'pycon.attendeereg',
    'pycon.badges',
    'pycon.schedule',
    'jobboard',
    'django.contrib.admin',
)

ABSOLUTE_URL_OVERRIDES = {
    'propmgr.proposal': # sync with urls.py
        lambda o: "%sconference/proposals/%d/" % (ROOT_URL, o.id),
}

class NullStream(object):
    def write(*args, **kwdargs): pass
    writeline = write
    writelines = write

RESTRUCTUREDTEXT_FILTER_SETTINGS = { 'cloak_email_addresses': True,
                                     'file_insertion_enabled': False,
                                     'raw_enabled': False,
                                     'warning_stream': NullStream(),
                                     'strip_comments': True}

AUTH_PROFILE_MODULE = "usermgr.UserProfile"

FORCE_LOWERCASE_TAGS = True

SCHEDULE_COOKIE_MAX_AGE = 60*60*24*31*3 ## 3 months (about)

NAVBAR_TREE_MAX_DEPTH = 3
NAVBAR_TREE_SHOW_DEPTH = 0
NAVBAR_TREE_MARK_SELECTED = True

CACHE_BACKEND = "locmem:///?max_entries=3000"
#CACHE_MIDDLEWARE_SECONDS = 300
#MAX_DURATION = 180

GOOGLE_SEARCH_KEY="012663505664874652253:gefcynhzofi"

PAYPAL_LOGIN   = "JatDayraps"
PAYPAL_PARTNER = "VeriSign"
PAYPAL_URL     = "https://payflowlink.paypal.com"
#PAYPAL_URL = "/2008/registration/new/sorry/"

GHOSTSCRIPT_CMD = '/usr/bin/gs'

app_configs_from_global_settings(globals())
