Thank you, howesc and especially Ricardo. That code snippet worked. I can 
now see my tickets on app engine.

On Tuesday, April 24, 2012 8:41:33 PM UTC-5, Ricardo Pedroso wrote:
>
> On Tue, Apr 24, 2012 at 12:57 AM, David Phillips
> <david....@gmail.com <david.phillips....@gmail.com>> wrote:
> > I don't know how to read the tickets web2py generates on app engine. On
> > devserver, the tickets are shown in their entirety, but on the production
> > server, the datastore viewer only shows the first 1000 or so characters. 
> I
> > can't figure out a way to see the entire ticket.
> >
> > The database management (appadmin) page doesn't show the tickets table,
> > although it shows web2py_session_rage.
> >
> > So, I wrote this action in a controller:
> >
> > def download_ticket():
> >
> > id = request.args[0]
> >
> > rec = db (db.web2py_ticket_rage.id == id).select().first()
> >
> > return rec.ticket_data
> >
> >
> > where web2py_ticket_rage is the name of the table where the tickets are
> > stored according to the dashboard. But when I execute, this exception is
> > raised:
> >
> > KeyError: 'web2py_ticket_rage'
> >
>
> You need to db.define_table()
>
> > Fortunately, there is a lot of information in the app engine logs, but I
> > would still like to see the ticket. So, is therea way to view tickets on 
> app
> > engine?
>
> I have this in the beginning of appadmin after the imports:
>
> if request.env.web2py_runtime_gae:
>     import cPickle
>
>     tablename = 'web2py_ticket_'+request.application
>     db.define_table(
>                 tablename,
>                 Field('ticket_id', length=100),
>                 Field('ticket_data', 'text'),
>                 Field('created_datetime', 'datetime'),
>     )
>
>     def pre_widget(field, value, **attributes):
>         return PRE(value)
>
>     def traceback_ticket_widget(field, value, **attributes):
>         return PRE(cPickle.loads(value)['traceback'],
>                    _style="color:#ddd;background-color:#000;padding:4px")
>
>     db[tablename].ticket_id.widget = pre_widget
>     db[tablename].ticket_data.widget = traceback_ticket_widget
>     db[tablename].created_datetime.widget = pre_widget
>
>
> and it's working for me.
>
> The definition of the table you can copy from gluon/restricted.py
> around line 75.
>
> Note that if you try insert a new ticket through appadmin it will
> raise an exception,
> but I leave it this way as a way to generate a ticket if I need.
>
> Ricardo
>
>

Reply via email to