[web2py] Re: How to use the administrator account to check error for apache + web2py framework?

2016-07-02 Thread Jing Lu
Thanks, isi_jca!!


Best,
Jing

On Saturday, July 2, 2016 at 8:26:36 AM UTC-4, isi_jca wrote:
>
> Hi!!!
>
> 1°) Create an item menu like this:
>
> ('Ticket de Errores', URL()==URL('tickets', 'errors'), 
> URL('tickets','errors')),
>
>
> 2°) Copy tickets.py in controller
>
> 3°) Extract tickets.7z in view
>
> Regards.
>
> El jueves, 30 de junio de 2016, 18:25:19 (UTC-3), Jing Lu escribió:
>>
>> Dear Web2py developers,
>>
>> The admin is blocked by the apache config. If I still want to use admin 
>> account to check error information, what should I do?
>>
>>
>> Thanks,
>> Jing
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to use the administrator account to check error for apache + web2py framework?

2016-07-02 Thread isi_jca
Hi!!!

1°) Create an item menu like this:

('Ticket de Errores', URL()==URL('tickets', 'errors'), 
URL('tickets','errors')),


2°) Copy tickets.py in controller

3°) Extract tickets.7z in view

Regards.

El jueves, 30 de junio de 2016, 18:25:19 (UTC-3), Jing Lu escribió:
>
> Dear Web2py developers,
>
> The admin is blocked by the apache config. If I still want to use admin 
> account to check error information, what should I do?
>
>
> Thanks,
> Jing
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# -*- coding: utf-8 -*-

import re
from gluon.admin import *
from gluon.fileutils import abspath, read_file, write_file
from gluon.utils import web2py_uuid
from gluon.tools import Config
from gluon.compileapp import find_exposed_functions
from glob import glob
import shutil
import platform

#Parece que es la variable que indica si está logueado o no
is_gae = False
MULTI_USER_MODE = False
try:
import git
if git.__version__ < '0.3.1':
raise ImportError("Your version of git is %s. Upgrade to 0.3.1 or better." % git.__version__)
have_git = True
except ImportError, e:
have_git = False
GIT_MISSING = 'Requires gitpython module, but not installed or incompatible version: %s' % e

from gluon.languages import (read_possible_languages, read_dict, write_dict,
 read_plural_dict, write_plural_dict)
class TRACEBACK(object):
""" Generate the traceback """

def __init__(self, text):
""" TRACEBACK constructor """

self.s = make_links(CODE(text).xml())

def xml(self):
""" Returns the xml """

return self.s

def get_app(name=None):
app = name or request.args(0)
if (app and os.path.exists(apath(app, r=request)) and
(not MULTI_USER_MODE or is_manager() or
 db(db.app.name == app)(db.app.owner == auth.user.id).count())):
return app
session.flash = T('App does not exist or you are not authorized')
redirect(URL('site'))

def make_link(path):
""" Create a link from a path """
tryFile = path.replace('\\', '/')

if os.path.isabs(tryFile) and os.path.isfile(tryFile):
(folder, filename) = os.path.split(tryFile)
(base, ext) = os.path.splitext(filename)
app = get_app()

editable = {'controllers': '.py', 'models': '.py', 'views': '.html'}
for key in editable.keys():
check_extension = folder.endswith("%s/%s" % (app, key))
if ext.lower() == editable[key] and check_extension:
return A('"' + tryFile + '"',
 _href=URL(r=request,
 f='edit/%s/%s/%s' % (app, key, filename))).xml()
return ''



def make_links(traceback):
""" Make links using the given traceback """

lwords = traceback.split('"')

# Making the short circuit compatible with <= python2.4
result = (len(lwords) != 0) and lwords[0] or ''

i = 1

while i < len(lwords):
link = make_link(lwords[i])

if link == '':
result += '"' + lwords[i]
else:
result += link

if i + 1 < len(lwords):
result += lwords[i + 1]
i = i + 1

i = i + 1

return result

def ticket():
""" Ticket handler """

if len(request.args) != 2:
session.flash = T('invalid ticket')
redirect(URL('site'))

app = get_app()
myversion = request.env.web2py_version
ticket = request.args[1]
e = RestrictedError()
e.load(request, app, ticket)

return dict(app=app,
ticket=ticket,
output=e.output,
traceback=(e.traceback and TRACEBACK(e.traceback)),
snapshot=e.snapshot,
code=e.code,
layer=e.layer,
myversion=myversion)

def errors():
""" Error handler """
import operator
import os
import pickle
import hashlib

app = get_app(request.application)
if is_gae:
method = 'dbold' if ('old' in
 (request.args(1) or '')) else 'dbnew'
else:
method = request.args(1) or 'new'
db_ready = {}
db_ready['status'] = get_ticket_storage(app)
db_ready['errmessage'] = T(
"No ticket_storage.txt found under /private folder")
db_ready['errlink'] = "http://web2py.com/books/default/chapter/29/13#Collecting-tickets;

if method == 'new':
errors_path = apath('%s/errors' % app, r=request)

delete_hashes = []
for item in request.vars:
if item[:7] == 'delete_':