コード例 #1
0
ファイル: session.py プロジェクト: keizo/kulu
"""User session handling functions."""
# standard library imports
import time
import random

import sha

# webpy imports
import web

# drupy imports
from drupy import *
import glbl
import loader
mod = loader.import_('modules')


def read():
    """returns a user storage object associated with the session"""
    cookies = web.cookies()
    if not hasattr(cookies,'_SID_'): 
        # this is the case of first time visitors and clients that 
        # don't store cookies (eg. web crawlers).
        print 'not capable of cookies or a brand new user, so i am adding one'
        new_sid = _generate_id()
        user = mod.user.anonymous_user(sid=new_sid)
        return user

    #Otherwise, if the session is still active, we have a record of the client's session in the database.
    sid = cookies._SID_
コード例 #2
0
ファイル: watchdog.py プロジェクト: keizo/kulu
"""
 * System monitoring and logging for administrators.
 *
 * The watchdog module monitors your site and keeps a list of
 * recorded events containing usage and performance data, errors,
 * warnings, and similar operational information.
 *
 see includes.system.log() function
"""
from web import form
import web
from drupy import *
import loader
inc = loader.import_('includes')

urls = (
    '/admin/logs','watchdog_overview',
    '/admin/logs/recent', 'watchdog_recent',
#    '/admin/logs/hits','hits',
#    '/admin/logs/access-denied','access_denied',
#    '/admin/logs/page-not-found','pagenotfound',
#    '/admin/logs/referrers','referrers',
#    '/admin/logs/status','status'
    )

class watchdog_overview(page):
    def GET(self):
        page = self.page
        form = form_overview()
        content = form.render()
        content += 'watchdog overview goes here'
コード例 #3
0
ファイル: index.py プロジェクト: keizo/kulu
"""
__revision__ = "9"
__license__ = "MIT License"
__author__ = "Keizo Gates <*****@*****.**>"

#standard library imports

#webpy imports
import web
import db_params

#drupy imports
import glbl
from drupy import *
import loader
inc = loader.import_('includes')
mod = loader.import_('modules')

#
## URLS
#
# urls for these modules loaded before other modules, in order
pre_modules = ('home','node','user')  
#post_modules = ('path',)
bot_urls = ('/(.*)','url_handler')

# Add in module urls
urls = inc.urls.combine_urls(pre_modules, mod, bot_urls)
print urls