making it work on appengine

22 views
Skip to first unread message

Marco Seguri

unread,
Dec 4, 2013, 11:45:53 AM12/4/13
to django-a...@googlegroups.com
Hello,

can you help me porting your library to appengine?

First problem was Provider fields bad naming: key isn't probably a good choice. Renamed key to consumer_key and secret to consumer_secret.

Second problem was ProviderManager.enabled method because JOINs are not allowed. Resolved using dbindexer and the following indexes.py:

from allaccess.models import ProviderManager
from dbindexer.lookups import StandardLookup
from dbindexer.api import register_index
register_index(ProviderManager, {
    'consumer_key__is_null': StandardLookup(),
    'consumer_secret__is_null': StandardLookup()
})
Third problem is that this fires an AttributeError cause ProviderManager has no _meta attribute. Stackoverflow suggests to change ProviderManager inheritance from models.Manager to models.Model but this causes more problems. This time I'm asking you what is ProviderManager purpose, this time I'm thinking how to remove it cause it needs too much fixes.

Can you help me please?

Mark Lavin

unread,
Dec 4, 2013, 8:45:28 PM12/4/13
to django-a...@googlegroups.com
Marco,

I have little to no experience using Django on App Engine so I'm not sure how much help I can be. It isn't clear why ProviderManager.enabled might cause problems. It does not create any joins. It simply filters out Provider records which have NULL key/secret values. However your register_index call does not appear to be correct. The first argument should be the Model class (Provider) not the Manager (ProviderManager).

Best,

Mark


--
You received this message because you are subscribed to the Google Groups "django-all-access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-all-acc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Marco Seguri

unread,
Dec 6, 2013, 8:48:41 AM12/6/13
to django-a...@googlegroups.com
Hi Mark,

thanks. Changing index still gives error. The main problem is that on appengine "Only one property per query may have inequality filters (<=, >=, <, >)". So, this query is not valid:

super(ProviderManager, self).filter(consumer_key__isnull=False, consumer_secret__isnull=False)

which translates to:

SELECT allaccess_provider.id, allaccess_provider.name, allaccess_provider.request_token_url, allaccess_provider.authorization_url, allaccess_provider.access_token_url, allaccess_provider.profile_url, allaccess_provider.consumer_key, allaccess_provider.consumer_secret FROM allaccess_provider WHERE (allaccess_provider.consumer_secret IS NOT NULL AND allaccess_provider.consumer_key IS NOT NULL)

This also does not work:

q1 = super(ProviderManager, self).filter(consumer_key__isnull=False)
q2 = super(ProviderManager, self).filter(consumer_secret__isnull =False
return q1 & q2

I'm actually working on your code removing all enabled() calls, in the meanwhile can you help me find a way to keep the enabled feature?
Reply all
Reply to author
Forward
0 new messages