Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
Where does this go: Model.all().filter('ngrams =', word).filter('ngrams ', word + u'\ufffd') in the call. Where inside: rows=db(here??).select(here??) I've tried several things. gae keeps giving me filter or all KeyError. -wes On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com

Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
I can't find any examples of web2py and gae select with StringListProperty. Where did you find the example below? I've looked in the web2py list emails, but I can't see any other working examples. How do you do this with web2py pseudo code: form(_query) def aview

[web2py] Re: first gae app

2010-02-18 Thread mdipierro
db(db.table.slp=='value').select() checks that 'value' is in the slp db(db.table.slp'value').select() checks that at least one element is less than 'value' db(db.table.slp'value').select() checks that at least one element if greater then 'value' slp is the name of your field of type

Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
Thank you Massimo. http://web2pyapi.appspot.com/ide/default/models is working now! It only has one record right now, but I'm trying to figure out how to parse lines like: l=if request.env.web2py_runtime_gae: l=l.replace('.',' ') l=l.replace('_',' ') l=l.replace(':',' ') l=l.split(' ') then

Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
I think this fixes it: in a form this gets entered a=[u'a',u'b',u'aa',u'bbb',u'cc'] a validation rule with this in it does the trick :) a[3:-2].split(',u') On Thu, Feb 18, 2010 at 5:42 PM, Wes James compte...@gmail.com wrote: I finally think I'm getting there and I see that data after it

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
OK. That field is a text field on gae now, how do I change it to gae.StringListProperty type? On Tue, Feb 16, 2010 at 9:50 PM, mdipierro mdipie...@cs.depaul.edu wrote: You are mixing gae syntax and dal syntax. This is only allowed in from gluon.contrib.gql import gae

[web2py] Re: first gae app

2010-02-17 Thread mdipierro
As far as web2py is concerned you just change the type. As far as GAE is concerned I do not know. Try and see what happens. On Feb 17, 9:56 am, Wes James compte...@gmail.com wrote: OK.  That field is a text field on gae now, how do I change it to gae.StringListProperty type? On Tue, Feb 16,

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
After some changes when I try to add an entity on gae through their interface, the StringListProperty field does not even show for me to put data in it. If I edit a record that already has some data, the StringListProperty field has [] in it, but if I leave it blank or add some data like

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
I removed all the data and tweaked the model a bit so all it looks like is: if request.env.web2py_runtime_gae: db = DAL('gae') session.connect(request, response, db=db) # and store sessions and tickets there else: db = DAL('sqlite://storage.sqlite') from gluon.tools import *

[web2py] Re: first gae app

2010-02-17 Thread mdipierro
because now db.table.insert(yourlistfield=.) has to be a list. You need to create a validator that takes the input and filters it into a list. I cannot write that for you since it depends on how you insert the data. On Feb 17, 12:57 pm, Wes James compte...@gmail.com wrote: I removed all

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
I'm noticing now why this is a problem. When I put [] in the field and submit it, it gets processed and comes out '[]' instead of just []. If it is a StringListProperty, shouldn't that come out [] not '[]'? -wes On Wed, Feb 17, 2010 at 1:57 PM, mdipierro mdipie...@cs.depaul.edu wrote: because

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
line 934 in sqlhtml.py On Wed, Feb 17, 2010 at 2:10 PM, Wes James compte...@gmail.com wrote: I'm noticing now why this is a problem.  When I put [] in the field and submit it, it gets processed and comes out '[]' instead of just [].  If it is a StringListProperty, shouldn't that come out []

Re: [web2py] Re: first gae app

2010-02-17 Thread Wes James
So I have been working on a validator and trying to simply make a list from a string. a=['a','b'] b=a[1:-1].split(',') returns [ 'a' , 'b' ] Is there a simpler way? On Wed, Feb 17, 2010 at 1:57 PM, mdipierro mdipie...@cs.depaul.edu wrote: because now db.table.insert(yourlistfield=.)

[web2py] Re: first gae app

2010-02-17 Thread mdipierro
In my todo list On Feb 17, 4:52 pm, Wes James compte...@gmail.com wrote: So I have been working on a validator and trying to simply make a list from a string. a=['a','b'] b=a[1:-1].split(',') returns [ 'a' , 'b' ] Is there a simpler way? On Wed, Feb 17, 2010 at 1:57 PM,

[web2py] Re: first gae app

2010-02-17 Thread mdipierro
n... class IS_LIST(): def __call__(self,value): return ([x.strip() for x in value.split(',')],None) def formatter(self,value): return ', '.join(value) Field('mylist',gae.StringListProperty(),requires=IS_LIST()) On Feb 17, 8:38 pm, Richard richar...@gmail.com

Re: [web2py] Re: first gae app

2010-02-16 Thread Wes James
so if I created a field Field('fieldKey', 'text') and put ['web2py', 'web2p', 'web2', 'web', 'we', 'w'], in for the value and then did query=request.vars._query rows=db(db.table.all().filter('fieldKey =', query).filter('fieldKey ', query + u'\ufffd')).select(db.table.ALL,

Re: [web2py] Re: first gae app

2010-02-16 Thread Wes James
There does not seem to be an .all(). How should the line be written? thx, -wes On Tue, Feb 16, 2010 at 4:25 PM, Wes James compte...@gmail.com wrote: so if I created a field Field('fieldKey', 'text') and put ['web2py', 'web2p', 'web2', 'web', 'we', 'w'], in for the value and then did

[web2py] Re: first gae app

2010-02-16 Thread mdipierro
You are mixing gae syntax and dal syntax. This is only allowed in from gluon.contrib.gql import gae db.define_table('mytable',Field('this_is_a_list',type=gae.StringListProperty())) queries must use dal syntax. On Feb 16, 5:46 pm, Wes James compte...@gmail.com wrote: There does not seem to be

[web2py] Re: first gae app

2010-02-14 Thread Richard
sounds like this will be useful. StringListProperty is a native gae type now supported by web2py: http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringListProperty http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa488e855 To get around the

[web2py] Re: first gae app

2010-02-13 Thread Richard
hi wes, something like this could be really nice for browsing the function docstrings. Do you intend to take it further? If you use a StringListProperty to store all the ngrams (eg: web2py, web2p, web2, web, we, w) then it could match partial words. Richard On Feb 13, 8:31 am, Wes James

Re: [web2py] Re: first gae app

2010-02-13 Thread Wes James
Richard, Do you have a python example of this? I'll check on StringListProperty also and see how it works. (would this work on gae?) I was trying somthing else since like is not supported, but this might work. I would like this site to provide quick search on anything that would be helpful in

Re: [web2py] Re: first gae app

2010-02-13 Thread Thadeus Burgess
i have a web2py app that uses ngrams Also I made a python program that ngrams an mp3 library so you can quickly search and create playlists. http://hg.thadeusb.com/Audio/PlaylistGrepper/ and here is the web2py app http://static.thadeusb.com/web2py.app.ngram.w2p -Thadeus On Sat, Feb 13,