當前位置: 首頁>>代碼示例>>Python>>正文


Python restricted.TicketStorage類代碼示例

本文整理匯總了Python中gluon.restricted.TicketStorage的典型用法代碼示例。如果您正苦於以下問題:Python TicketStorage類的具體用法?Python TicketStorage怎麽用?Python TicketStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TicketStorage類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: log_ticket

def log_ticket(ticket, logger=LOG):
    """Log a ticket."""
    if not ticket:
        return

    # Ticket may have have the app prepended, for example:
    # zcomx/108.162.141.78.2016-06-20.14-36-01.3ac605e2-5ff9-47f1-872f-ab291cdb
    if '/' in ticket:
        parts = ticket.split(os.sep)
        ticket_id = parts[-1]
    else:
        ticket_id = ticket

    if not ticket_id:
        return

    request = current.request
    ticket_storage = TicketStorage()
    app = None   # 'app' is an errors sub directory, not used
    contents = ticket_storage.load(request, app, ticket_id)
    traceback = contents.get('traceback')
    if not traceback:
        return
    for line in traceback.split("\n"):
        logger.error(line)
開發者ID:zcomx,項目名稱:zcomix.com,代碼行數:25,代碼來源:restricted.py

示例2: URL

ignore_rw = True
response.view = 'appadmin.html'
if menu:
    response.menu = [[T('design'), False, URL('admin', 'default', 'design',
                 args=[request.application])], [T('db'), False,
                 URL('index')], [T('state'), False,
                 URL('state')], [T('cache'), False,
                 URL('ccache')]]

# ##########################################################
# ## auxiliary functions
# ###########################################################

if False and request.tickets_db:
    from gluon.restricted import TicketStorage
    ts = TicketStorage()
    ts._get_table(request.tickets_db, ts.tablename, request.application)

def get_databases(request):
    dbs = {}
    for (key, value) in global_env.items():
        try:
            cond = isinstance(value, GQLDB)
        except:
            cond = isinstance(value, SQLDB)
        if cond:
            dbs[key] = value
    return dbs

databases = get_databases(None)
開發者ID:AbhishekNose,項目名稱:ucmag,代碼行數:30,代碼來源:appadmin.py

示例3: open

from gluon.utils import md5_hash
from gluon.restricted import RestrictedError, TicketStorage
from gluon import DAL

SLEEP_MINUTES = 5

errors_path = os.path.join(request.folder, 'errors')
try:
    db_string = open(os.path.join(request.folder, 'private', 'ticket_storage.txt')).read().replace('\r', '').replace('\n', '').strip()
except:
    db_string = 'sqlite://storage.db'

db_path = os.path.join(request.folder, 'databases')

tk_db = DAL(db_string, folder=db_path, auto_import=True)
ts = TicketStorage(db=tk_db)
tk_table = ts._get_table(
    db=tk_db, tablename=ts.tablename, app=request.application)


hashes = {}

while 1:
    if request.tickets_db:
        print "You're storing tickets yet in database"
        sys.exit(1)

    for file in os.listdir(errors_path):
        filename = os.path.join(errors_path, file)

        modified_time = os.stat(filename)[stat.ST_MTIME]
開發者ID:Gabba-git,項目名稱:Assignments,代碼行數:31,代碼來源:tickets2db.py


注:本文中的gluon.restricted.TicketStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。