Esempio n. 1
0
    return wrapped


class Pages(object):

    @expose(r'^$')
    def index(self, req):
        return 'Hello World!'

    @expose(r'^downloads/$')
    def downloads(self, req):
        return 'Downloads'

    @expose(r'^downloads$')
    def download_redirect(self, req):
        raise HttpFound('downloads/')

    @expose(r'^downloads/(\d+)$')
    def downloads_detail(self, req, download_id):
        download_id = int(download_id)
        return 'You\'re looking at download "%d".' % download_id


# create a instance for the application and register a set of pages
app = Application()
app.register(Pages())

if __name__ == '__main__':
    from colubrid import execute
    execute(app, reload=True, debug=True)
Esempio n. 2
0
# -*- coding: utf-8 -*-
"""
    Colubrid says Hello World
"""
from colubrid import BaseApplication, Request


class HelloWorld(BaseApplication):

    def __init__(self, environ, start_response):
        super(HelloWorld, self).__init__(environ, start_response)
        self.request = Request(environ)

    def process_request(self):
        self.request.send_response('Hello World')

app = HelloWorld

if __name__ == '__main__':
    from colubrid import execute
    execute()
benutzt wird.
"""

#~ print "Content-type: text/html; charset=utf-8\r\n"
#~ import cgitb;cgitb.enable()

from PyDown.PyDown import cfg, app

# Überschreiben der Basis-Einstellungen
#~ cfg["allows_user"]      = ("jedie", "snacker", "nero1976", "idontno")
cfg["admin_username"]   = "******"

cfg["ext_whitelist"]    = (".mp3",)
cfg["base_path"]        = "M:/"

cfg["only_https"]       = False
#~ cfg["only_https"]       = True

cfg["only_auth_users"]  = False

# Zugriffe nur von bestimmten IP's zulassen
cfg["IP_range"] = ["127.0.0.1"]

cfg["debug"]            = True


if __name__ == '__main__':
    from colubrid import execute
    execute(app, reload=True)

# Dier User erhält Admin Rechte
cfg["admin_username"] = "******"

# Datei-Endungsfilter, nur diese Dateien werden beachtet
cfg["ext_whitelist"] = (".mp3", )

# Basis-Pfad, der "Rekursiv-Freigegeben" werden soll.
cfg["base_path"] = "/tmp"

# Nur HTTPs Verbindungen erlauben?
cfg["only_https"] = True

# Zugriff nur eingeloggte User, durch Apache's .htaccess-Auth erlauben?
cfg["only_auth_users"] = True

# Debugausgaben anzeigen?
cfg["debug"] = False

# Ab welcher Anzahl von Verzeichnissen sollen Buchstaben eingeblendet werden?
cfg["min_letters"] = 3

# Wenn als Temp-Verz. nicht das default-System-Temp-Verz. genommen werden soll
cfg["temp"] = None

#_____________________________________________________________________________

if __name__ == '__main__':
    # Colubrid's name-hook
    from colubrid import execute
    execute()