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 <[email protected]> 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 <[email protected]> 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