This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from logging import Formatter | |
class JSONStreamFormatter(Formatter): | |
def format(self, record): | |
""" | |
Format the specified record as text. | |
The record's attribute dictionary is used as the operand to a | |
string formatting operation which yields the returned string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<rss version="2.0"> | |
<channel> | |
<title>RSS Example</title> | |
<description>This is an example of an RSS feed</description> | |
<link>http://www.domain.com/link.htm</link> | |
<lastBuildDate>Mon, 28 Aug 2006 11:12:55 -0400 </lastBuildDate> | |
<pubDate>Tue, 29 Aug 2006 09:00:00 -0400</pubDate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from picocms.models import CMSModel, CMSCategory, ActiveModelManager | |
from picocms import fields | |
ARTICLES_ROOT = 'Publications' | |
class Article(CMSModel): | |
""" Defines an article for the CMS """ | |
date_display = models.DateTimeField(default=datetime.datetime.now()) #: | |
highlight = models.BooleanField(default=False, verbose_name=u'Highlight') #: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from picocms.models import CMSModel, CMSCategory, ActiveModelManager | |
from picocms import fields | |
ARTICLES_ROOT = 'Publications' | |
class Article(CMSModel): | |
""" Defines an article for the CMS """ | |
date_display = models.DateTimeField(default=datetime.datetime.now()) #: | |
highlight = models.BooleanField(default=False, verbose_name=u'Highlight') #: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Background tasks to be run either by uwsgi, or directly if on dev server. | |
""" | |
import cPickle as pickle | |
import logging | |
from django.core.mail import send_mail | |
LOG = logging.getLogger(__name__) | |
HAS_UWSGI = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from datetime import datetime | |
import json | |
from urllib import urlopen | |
YAHOO_CURRENCY_CONVERTER = 'http://finance.yahoo.com/connection/currency-converter-cache?date=' | |
class CurrencyCoverterException(Exception): | |
def __init__(self, value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from django.utils.cache import patch_vary_headers | |
from django.utils import translation | |
from django.conf import settings | |
from cms.utils.i18n import get_default_language | |
class StripGoogleAnalyticsCookieMiddleware(object): | |
""" | |
This middleware class is there to make sure that the cookies from | |
Google Analitics does not force django to recompute this page. |