i went through this in GAE as well, and figured this out:

    #get the storage, and tickle the right part to get the database
table
    ts = TicketStorage(db=request.tickets_db)
    table_obj = ts._get_table(ts.db, ts.tablename,
request.application)
    if table_obj:
        table_obj.truncate()

note that i abandoned this method and went to storing sessions and
tickets in memcache as suggested here:
http://groups.google.com/group/web2py/browse_thread/thread/cd89f11de4d23b53/79f05b2c08d7b9dd?lnk=gst&q=google+app+engine+session+cleanup#79f05b2c08d7b9dd
because the useful content of the tickets (the traceback) is logged by
google in their logs and those seem to be available forever.

good luck!

christian


On Apr 14, 12:57 pm, Chris S <sanders.ch...@gmail.com> wrote:
> Just to be certain I have upgrade to the latest web2py and nothing has
> changed.
>
> On Apr 14, 2:26 pm, Chris S <sanders.ch...@gmail.com> wrote:
>
> > Oh, I'm running web2py Version 1.66.2 I believe.  I haven't worked on
> > this project since that was the current version.  Updating shouldn't
> > break anything right?  If so I can give that a shot.
>
> > On Apr 14, 2:24 pm, Chris S <sanders.ch...@gmail.com> wrote:
>
> > > Sure thing.
>
> > > In my default.py I have defined:
>
> > > ---------------------
> > > def removeticket():
> > >     from google.appengine.ext.db import GqlQuery
> > >     from google.appengine.ext import db as gdb
> > >     import datetime
>
> > >     #Define number of days to keep ticket
> > >     OldestTicket=14
>
> > >     today = datetime.datetime.today()
> > >     earliest_date = today - datetime.timedelta(OldestTicket)
> > >     query = GqlQuery("SELECT * FROM web2py_ticket_init WHERE
> > > created_datetime < :1", earliest_date, LIMIT=25)
>
> > >     gdb.delete(query.fetch(25))
> > >     return 'Tickets Purged'
> > > ---------------
>
> > > This produces the following error:
>
> > > ---------------
> > > In FILE: /base/data/home/apps/aion-info/1.341252660762954348/
> > > applications/init/controllers/default.py
>
> > > Traceback (most recent call last):
> > >   File "/base/data/home/apps/aion-info/1.341252660762954348/gluon/
> > > restricted.py", line 178, in restricted
> > >     exec ccode in environment
> > >   File "/base/data/home/apps/aion-info/1.341252660762954348/
> > > applications/init/controllers/default.py:removeticket", line 686, in
> > > <module>
> > >   File "/base/data/home/apps/aion-info/1.341252660762954348/gluon/
> > > globals.py", line 101, in <lambda>
> > >     self._caller = lambda f: f()
> > >   File "/base/data/home/apps/aion-info/1.341252660762954348/
> > > applications/init/controllers/default.py:removeticket", line 627, in
> > > removeticket
> > >   File "/base/python_lib/versions/1/google/appengine/ext/db/
> > > __init__.py", line 2059, in __init__
> > >     model_class = class_for_kind(self._proto_query._entity)
> > >   File "/base/python_lib/versions/1/google/appengine/ext/db/
> > > __init__.py", line 228, in class_for_kind
> > >     raise KindError('No implementation for kind \'%s\'' % kind)
> > > KindError: No implementation for kind 'web2py_ticket_init'
> > > ---------------
>
> > > I use this same type of function to remove sessions and it works just
> > > fine.  It's only with the tickets that it errors out.  Run on the
> > > local dev server both run just fine.
> > > I know how to use the DAL to delete entries (actually you showed me
> > > quite some time ago) but since I didn't define these two models it's a
> > > bit different.
>
> > > Chris
>
> > > On Apr 14, 2:12 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > This is not a Python error
>
> > > > > KindError: No implementation for kind
>
> > > > can we see the complete traceback and the code that triggers it?
>
> > > > On Apr 14, 1:40 pm, Chris S <sanders.ch...@gmail.com> wrote:
>
> > > > > I'm trying to use a function that I can call via a cron job to remove
> > > > > old tickets and sessions.  When I try to call the function on the
> > > > > ticket I get "KindError: No implementation for kind".  I suspect this
> > > > > is because I need to import the model for the Tickets, but I can't
> > > > > find where it's defined.
>
> > > > > How can I import the web2py_ticket_init definition so that GAE can
> > > > > find it?
>
> > > > > Thanks,
> > > > > Chris
>
>


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to