-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of v0.4.2 as fetched from Google Code Archive
- Loading branch information
Showing
36 changed files
with
11,365 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env python | ||
# CirruxCache provides dynamic HTTP caching on AppEngine (CDN like) | ||
# Copyright (C) 2009 Samuel Alba <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
|
||
"""CirruxCache provides dynamic HTTP caching on AppEngine (CDN like) | ||
http://cirrux.org/cache/ | ||
http://code.google.com/p/cirruxcache/ | ||
""" | ||
|
||
__version__ = '0.4.2' | ||
__author__ = [ | ||
'Samuel Alba <[email protected]>' | ||
] | ||
__license__ = 'GNU Public License version 2' | ||
|
||
import sys, os | ||
root = os.path.dirname(os.environ['PATH_TRANSLATED']) | ||
sys.path.append(os.path.join(root, 'lib')) | ||
sys.path.append(os.path.join(root, 'contrib')) | ||
|
||
import logging | ||
import web | ||
|
||
import config | ||
from services.cron import Cron | ||
from services.admin import Admin | ||
from services.store import Store | ||
from services.debug import Debug | ||
|
||
|
||
class Root(object): | ||
|
||
def GET(self, request): | ||
web.header('Content-Type', 'text/plain') | ||
content = 'CirruxCache (%s) / http://code.google.com/p/cirruxcache/\n' % __version__ | ||
if request: | ||
raise web.HTTPError(status='404 Not Found', data=content) | ||
return content | ||
|
||
class VhostMapper(object): | ||
|
||
def __iter__(self): | ||
base = ( | ||
'/_admin/(.*)', 'Admin', | ||
'/_store/(.*)', 'Store', | ||
'/_cron/(.*)', 'Cron' | ||
) | ||
url = () | ||
urls = config.urls | ||
if 'HTTP_HOST' in web.ctx.environ: | ||
vhost = web.ctx.environ['HTTP_HOST'] | ||
if vhost in urls: | ||
url = urls[vhost] | ||
elif 'default' in urls: | ||
url = urls['default'] | ||
return iter(base + url + ('/(.*)', 'Root')) | ||
|
||
if __name__ == '__main__': | ||
# logging.getLogger().setLevel(logging.DEBUG) | ||
app = web.application(VhostMapper(), globals()) | ||
app.cgirun() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# CirruxCache provides dynamic HTTP caching on AppEngine (CDN like) | ||
# Copyright (C) 2009 Samuel Alba <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
|
||
application: appname | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
# Uncomment theses 3 lignes below to serve a static crossdomain.xml file | ||
#- url: /crossdomain\.xml | ||
# static_files: static/crossdomain.xml | ||
# upload: static/crossdomain.xml | ||
|
||
- url: /_static/((admin|jquery\.form|wtooltip)\.(js|css)) | ||
static_files: static/\1 | ||
upload: static/(admin|jquery\.form|wtooltip)\.(js|css) | ||
|
||
- url: /.* | ||
script: app.py | ||
|
||
derived_file_type: | ||
- python_precompiled |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# CirruxCache provides dynamic HTTP caching on AppEngine (CDN like) | ||
# Copyright (C) 2009 Samuel Alba <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
|
||
"""CirruxCache configuration file | ||
""" | ||
|
||
from lib import cache, redirect, forward, image | ||
urls = {} | ||
|
||
|
||
# EDIT BELOW | ||
|
||
urls['default'] = ( | ||
#'(/debug/.*)', 'Debug', | ||
'(/data/.*)', 'config.Static', | ||
'/www(/.*)', 'config.Www' | ||
) | ||
|
||
# POP definition | ||
# You can define and configure your Point Of Presence | ||
|
||
class Static(cache.Service): | ||
origin = 'http://static.mydomain.tld' | ||
maxTTL = 2592000 # 1 month | ||
ignoreQueryString = True | ||
|
||
class Www(cache.Service): | ||
origin = 'http://www.mydomain.tld' | ||
allowFlushFrom = ['127.0.0.1'] | ||
forceTTL = 3600 # 1 hour | ||
ignoreQueryString = True | ||
forwardPost = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
"""web.py: makes web apps (http://webpy.org)""" | ||
|
||
from __future__ import generators | ||
|
||
__version__ = "0.34" | ||
__author__ = [ | ||
"Aaron Swartz <[email protected]>", | ||
"Anand Chitipothu <[email protected]>" | ||
] | ||
__license__ = "public domain" | ||
__contributors__ = "see http://webpy.org/changes" | ||
|
||
import utils, db, net, wsgi, http, webapi, httpserver, debugerror | ||
import template, form | ||
|
||
import session | ||
|
||
from utils import * | ||
from db import * | ||
from net import * | ||
from wsgi import * | ||
from http import * | ||
from webapi import * | ||
from httpserver import * | ||
from debugerror import * | ||
from application import * | ||
from browser import * | ||
import test | ||
try: | ||
import webopenid as openid | ||
except ImportError: | ||
pass # requires openid module | ||
|
Oops, something went wrong.