[web2py] routes with file extensions

2010-06-11 Thread NickFranceschina
I know file extensions are optional... but you do have some nice
functionality in there that allows passing file extensions on to the
view... so if I were to request "app/controller/function.html" I would
get the matching (or generic) .html template... but if I were to
request "app/controller/function.json" I could get the matching (or
generic) .json template... and so on and so forth

problem is that when I try to use routes.py ... and I enter in the
defaults suggested in the documentation

routes_in = (
  ('/$c/$f', '/init/$c/$f'),
)


this ends up building a regular expression that won't match a
"function" part of the URL if it has an extension... so it only works
if the URL looks like this:
   app/controller/function
not this
   app/controller/function.html


I had to modify my route to look like this:
   ('/$c/$f(\\.\\w+)?', '/init/$c/$f')

now it works... but this should really be put into the framework (have
to change the way you're doing the compile_re() inside of rewrite.py)

didn't know how else to notify the guys in charge of the code... so
just writing it here...

-Nick Franceschina


[web2py] Re: routes with file extensions

2010-06-11 Thread NickFranceschina
ahh... right, thanks

so you could just leave it as is and just change the documentation.
Or perhaps a "function" really does consist of the "file name +
extension".  if you think that is so, then ya gotta change the code.



On Jun 11, 4:23 pm, mdipierro  wrote:
> true. Let me give this some thought.
>
> meanshile you can do
>
> outes_in = (
>    ('/$c/$f\.$ext', '/init/$c/$f.$ext'),
> )
>
> or
>
> outes_in = (
>    ('/$c/$anything', '/init/$c/$anything'),
> )
>
> On 11 Giu, 14:41, NickFranceschina  wrote:
>
>
>
> > I know file extensions are optional... but you do have some nice
> > functionality in there that allows passing file extensions on to the
> > view... so if I were to request "app/controller/function.html" I would
> > get the matching (or generic) .html template... but if I were to
> > request "app/controller/function.json" I could get the matching (or
> > generic) .json template... and so on and so forth
>
> > problem is that when I try to use routes.py ... and I enter in the
> > defaults suggested in the documentation
>
> > routes_in = (
> >   ('/$c/$f', '/init/$c/$f'),
> > )
>
> > this ends up building a regular expression that won't match a
> > "function" part of the URL if it has an extension... so it only works
> > if the URL looks like this:
> >    app/controller/function
> > not this
> >    app/controller/function.html
>
> > I had to modify my route to look like this:
> >    ('/$c/$f(\\.\\w+)?', '/init/$c/$f')
>
> > now it works... but this should really be put into the framework (have
> > to change the way you're doing the compile_re() inside of rewrite.py)
>
> > didn't know how else to notify the guys in charge of the code... so
> > just writing it here...
>
> > -Nick Franceschina


[web2py] difference between rows.json() and gluon.serializers.json(rows)

2010-06-12 Thread NickFranceschina
if I have a records collection (of type Rows) from a select() call
through the DAL...  why is the output different between these two
versions of json conversion?

>>> records.json()
'[{"description": "my description", "created_by": 1, "id": 1,
"created_on": "2010-06-06 23:21:52", "name": "my name"},
{"description": "moms community", "created_by": null, "id": 2,
"created_on": "2010-06-11 19:54:06", "name": "mom"}, {"description":
"dads community", "created_by": null, "id": 5, "created_on":
"2010-06-11 20:18:41", "name": "dad"}, {"description": "dads
community", "created_by": null, "id": 6, "created_on": "2010-06-12
16:28:19", "name": "dad"}]'


>>> from gluon.serializers import json
>>> json(records)
'{"1": {"created_on": "2010-06-06 23:21:52", "description": "my
description", "name": "my name", "id": 1, "created_by": 1}, "2":
{"created_on": "2010-06-11 19:54:06", "description": "moms community",
"name": "mom", "id": 2}, "5": {"created_on": "2010-06-11 20:18:41",
"description": "dads community", "name": "dad", "id": 5}, "6":
{"created_on": "2010-06-12 16:28:19", "description": "dads community",
"name": "dad", "id": 6}}'



the former is what I would expect... a list of dictionaries...

the latter builds a dictionary of dictionaries...





[web2py] Re: difference between rows.json() and gluon.serializers.json(rows)

2010-06-13 Thread NickFranceschina
anyone?

On Jun 12, 4:52 pm, NickFranceschina 
wrote:
> if I have a records collection (of type Rows) from a select() call
> through the DAL...  why is the output different between these two
> versions ofjsonconversion?
>
> >>> records.json()
>
> '[{"description": "my description", "created_by": 1, "id": 1,
> "created_on": "2010-06-06 23:21:52", "name": "my name"},
> {"description": "moms community", "created_by": null, "id": 2,
> "created_on": "2010-06-11 19:54:06", "name": "mom"}, {"description":
> "dads community", "created_by": null, "id": 5, "created_on":
> "2010-06-11 20:18:41", "name": "dad"}, {"description": "dads
> community", "created_by": null, "id": 6, "created_on": "2010-06-12
> 16:28:19", "name": "dad"}]'
>
> >>> from gluon.serializers importjson
> >>>json(records)
>
> '{"1": {"created_on": "2010-06-06 23:21:52", "description": "my
> description", "name": "my name", "id": 1, "created_by": 1}, "2":
> {"created_on": "2010-06-11 19:54:06", "description": "moms community",
> "name": "mom", "id": 2}, "5": {"created_on": "2010-06-11 20:18:41",
> "description": "dads community", "name": "dad", "id": 5}, "6":
> {"created_on": "2010-06-12 16:28:19", "description": "dads community",
> "name": "dad", "id": 6}}'
>
> the former is what I would expect... a list of dictionaries...
>
> the latter builds a dictionary of dictionaries...


[web2py] bug?

2010-06-20 Thread NickFranceschina
Version 1.79.2 (2010-06-08 22:45:26)

was browsing through the code implementing some custom authentication
and noticed this on line 1809 of tools.py:

   user.update_record(password=form.vars.new_password,
registration_key='', reset_password_key='')

where a few lines above you see this:

  passfield = self.settings.password_field


so I assume line 1809 should actually be:

   user.update_record(passfield=form.vars.new_password,
registration_key='', reset_password_key='')




-Nick Franceschina


[web2py] login_bare() blows up on GAE

2010-06-21 Thread NickFranceschina
I'm not sure what I'm doing wrong...   I've built a JSON service on
top of Web2py that uses Auth.login_bare() to authenticate via
AJAX...   my auth_user table looked like this (standard):

auth.settings.table_user = db.define_table('auth_user',
Field('first_name', length=512,default='', required=True),
Field('last_name', length=512,default='', required=True),
Field('display_name', length=512,default='', required=True),
Field('email', length=512,default='',required=True,
  requires = [IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
Field('password', 'password', readable=False, required=True,
  label='Password',
  requires=CRYPT(auth.settings.hmac_key)),
Field('registration_key', length=512,
  writable=True, readable=True,default=''),
Field('reset_password_key', length=512,
  writable=False, readable=False, default=''),
)


but then I added this field to the auth_user table:

Field('photo', 'upload')


and now it blows up on GAE at the moment it tries to do this (inside
of login_bare):

session.auth = Storage(user=user,
last_visit=request.now,
 
expiration=self.settings.expiration)

with this error message:

'Traceback (most recent call last):\n  File "C:\\SVNs\\T4H\\Buttrcup\
\www\\gluon\\main.py", line 391, in wsgibase\n
session._try_store_in_db(request, response)\n  File "C:\\SVNs\\T4H\
\Buttrcup\\www\\gluon\\globals.py", line 356, in _try_store_in_db\n
table._db(table.id == record_id).update(**dd)\n  File "C:\\SVNs\\T4H\
\Buttrcup\\www\\gluon\\contrib\\gql.py", line 744, in update\n
item.put()\n  File "C:\\Program Files (x86)\\Google\\google_appengine\
\google\\appengine\\ext\\db\\__init__.py", line 833, in put\n
return datastore.Put(self._entity, rpc=rpc)\n  File "C:\\Program Files
(x86)\\Google\\google_appengine\\google\\appengine\\api\
\datastore.py", line 282, in Put\n\'datastore_v3\', \'Put\', req,
datastore_pb.PutResponse(), rpc)\n  File "C:\\Program Files (x86)\
\Google\\google_appengine\\google\\appengine\\api\\datastore.py", line
186, in _MakeSyncCall\nrpc.check_success()\n  File "C:\\Program
Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
\apiproxy_stub_map.py", line 474, in check_success\n
self.__rpc.CheckSuccess()\n  File "C:\\Program Files (x86)\\Google\
\google_appengine\\google\\appengine\\api\\apiproxy_rpc.py", line 149,
in _WaitImpl\nself.request, self.response)\n  File "C:\\Program
Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
\datastore_file_stub.py", line 667, in MakeSyncCall\nresponse)\n
File "C:\\Program Files (x86)\\Google\\google_appengine\\google\
\appengine\\api\\apiproxy_stub.py", line 75, in MakeSyncCall\n
\'The request to API call %s.%s() was too large.\' % (service, call))
\nRequestTooLargeError: The request to API call datastore_v3.Put() was
too large.\n'


I'm using Wing IDE, and can't figure out how to debut through the GAE
server...


can someone point me in the right direction?  I'm going on about 40hrs
of straight development... and I can't think straight anymore...

Thank you!!
-Nick Franceschina






[web2py] login_bare() blows up on GAE

2010-06-21 Thread NickFranceschina
I'm not sure what I'm doing wrong...   I've built a JSON service on
top of Web2py that uses Auth.login_bare() to authenticate via
AJAX...   my auth_user table looked like this (standard):

auth.settings.table_user = db.define_table('auth_user',
Field('first_name', length=512,default='', required=True),
Field('last_name', length=512,default='', required=True),
Field('display_name', length=512,default='', required=True),
Field('email', length=512,default='',required=True,
  requires = [IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
Field('password', 'password', readable=False, required=True,
  label='Password',
  requires=CRYPT(auth.settings.hmac_key)),
Field('registration_key', length=512,
  writable=True, readable=True,default=''),
Field('reset_password_key', length=512,
  writable=False, readable=False, default=''),
)


but then I added this field to the auth_user table:

Field('photo', 'upload')


and now it blows up on GAE at the moment it tries to do this (inside
of login_bare):

session.auth = Storage(user=user,
last_visit=request.now,
 
expiration=self.settings.expiration)

with this error message:

'Traceback (most recent call last):\n  File "C:\\SVNs\\T4H\\Buttrcup\
\www\\gluon\\main.py", line 391, in wsgibase\n
session._try_store_in_db(request, response)\n  File "C:\\SVNs\\T4H\
\Buttrcup\\www\\gluon\\globals.py", line 356, in _try_store_in_db\n
table._db(table.id == record_id).update(**dd)\n  File "C:\\SVNs\\T4H\
\Buttrcup\\www\\gluon\\contrib\\gql.py", line 744, in update\n
item.put()\n  File "C:\\Program Files (x86)\\Google\\google_appengine\
\google\\appengine\\ext\\db\\__init__.py", line 833, in put\n
return datastore.Put(self._entity, rpc=rpc)\n  File "C:\\Program Files
(x86)\\Google\\google_appengine\\google\\appengine\\api\
\datastore.py", line 282, in Put\n\'datastore_v3\', \'Put\', req,
datastore_pb.PutResponse(), rpc)\n  File "C:\\Program Files (x86)\
\Google\\google_appengine\\google\\appengine\\api\\datastore.py", line
186, in _MakeSyncCall\nrpc.check_success()\n  File "C:\\Program
Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
\apiproxy_stub_map.py", line 474, in check_success\n
self.__rpc.CheckSuccess()\n  File "C:\\Program Files (x86)\\Google\
\google_appengine\\google\\appengine\\api\\apiproxy_rpc.py", line 149,
in _WaitImpl\nself.request, self.response)\n  File "C:\\Program
Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
\datastore_file_stub.py", line 667, in MakeSyncCall\nresponse)\n
File "C:\\Program Files (x86)\\Google\\google_appengine\\google\
\appengine\\api\\apiproxy_stub.py", line 75, in MakeSyncCall\n
\'The request to API call %s.%s() was too large.\' % (service, call))
\nRequestTooLargeError: The request to API call datastore_v3.Put() was
too large.\n'


I'm using Wing IDE, and can't figure out how to debut through the GAE
server...


can someone point me in the right direction?  I'm going on about 40hrs
of straight development... and I can't think straight anymore...

Thank you!!
-Nick Franceschina






[web2py] Re: login_bare() blows up on GAE

2010-06-22 Thread NickFranceschina
OK... I had uploaded a 900+kb photo by mistake (thought I had uploaded
100k photo)

also just realized that the schema for an "upload" Field on GAE
includes an extra 'blob' type on the record (obviously, since we can't
store files)... and my code was trying to convert records to JSON and
blowing up... have to tell it to skip any 'blob' fields.


working now!  thanks!!



On Jun 22, 2:50 am, mdipierro  wrote:
> You have something too large in the session and the datastore refuses
> to store the session in the database.
>
> On Jun 21, 11:32 pm, NickFranceschina 
> wrote:
>
>
>
> > I'm not sure what I'm doing wrong...   I've built a JSON service on
> > top of Web2py that uses Auth.login_bare() to authenticate via
> > AJAX...   my auth_user table looked like this (standard):
>
> > auth.settings.table_user = db.define_table('auth_user',
> >     Field('first_name', length=512,default='', required=True),
> >     Field('last_name', length=512,default='', required=True),
> >     Field('display_name', length=512,default='', required=True),
> >     Field('email', length=512,default='',required=True,
> >           requires = [IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
> >     Field('password', 'password', readable=False, required=True,
> >           label='Password',
> >           requires=CRYPT(auth.settings.hmac_key)),
> >     Field('registration_key', length=512,
> >           writable=True, readable=True,default=''),
> >     Field('reset_password_key', length=512,
> >           writable=False, readable=False, default=''),
> >     )
>
> > but then I added this field to the auth_user table:
>
> >     Field('photo', 'upload')
>
> > and now it blows up on GAE at the moment it tries to do this (inside
> > of login_bare):
>
> >                 session.auth = Storage(user=user,
> > last_visit=request.now,
>
> > expiration=self.settings.expiration)
>
> > with this error message:
>
> > 'Traceback (most recent call last):\n  File "C:\\SVNs\\T4H\\Buttrcup\
> > \www\\gluon\\main.py", line 391, in wsgibase\n
> > session._try_store_in_db(request, response)\n  File "C:\\SVNs\\T4H\
> > \Buttrcup\\www\\gluon\\globals.py", line 356, in _try_store_in_db\n
> > table._db(table.id == record_id).update(**dd)\n  File "C:\\SVNs\\T4H\
> > \Buttrcup\\www\\gluon\\contrib\\gql.py", line 744, in update\n
> > item.put()\n  File "C:\\Program Files (x86)\\Google\\google_appengine\
> > \google\\appengine\\ext\\db\\__init__.py", line 833, in put\n
> > return datastore.Put(self._entity, rpc=rpc)\n  File "C:\\Program Files
> > (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > \datastore.py", line 282, in Put\n    \'datastore_v3\', \'Put\', req,
> > datastore_pb.PutResponse(), rpc)\n  File "C:\\Program Files (x86)\
> > \Google\\google_appengine\\google\\appengine\\api\\datastore.py", line
> > 186, in _MakeSyncCall\n    rpc.check_success()\n  File "C:\\Program
> > Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > \apiproxy_stub_map.py", line 474, in check_success\n
> > self.__rpc.CheckSuccess()\n  File "C:\\Program Files (x86)\\Google\
> > \google_appengine\\google\\appengine\\api\\apiproxy_rpc.py", line 149,
> > in _WaitImpl\n    self.request, self.response)\n  File "C:\\Program
> > Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > \datastore_file_stub.py", line 667, in MakeSyncCall\n    response)\n
> > File "C:\\Program Files (x86)\\Google\\google_appengine\\google\
> > \appengine\\api\\apiproxy_stub.py", line 75, in MakeSyncCall\n
> > \'The request to API call %s.%s() was too large.\' % (service, call))
> > \nRequestTooLargeError: The request to API call datastore_v3.Put() was
> > too large.\n'
>
> > I'm using Wing IDE, and can't figure out how to debut through the GAE
> > server...
>
> > can someone point me in the right direction?  I'm going on about 40hrs
> > of straight development... and I can't think straight anymore...
>
> > Thank you!!
> > -Nick Franceschina


[web2py] Re: login_bare() blows up on GAE

2010-06-22 Thread NickFranceschina
on a related note... web apps rarely need to load the blob data at the
same time as the record...   the record should get loaded and then
that will create a link/img on a page which will make a separate
request for the blob.  and if I've read correctly... GAE always pulls
the entire object when you request it (you can't only select a few
fields)... do you know if this is still true?

if so, then I suppose the best design would be to put the blobs in a
separate table instead of the same table...

but as for automating the schema maintenance... if I create
  auth_user.Field('photo','upload')
instead of creating a 'photo' (string) and 'photo_blob' (blob) on the
same table, it should maybe create just 'photo' (string) and another
table called 'auth_user_photo' with one field and a reference?  or
maybe some other scheme... I dunno...

I did run across this Webslices post... but haven't dug into it yet to
see what it solves/provides...
  http://www.web2pyslices.com/main/slices/take_slice/63


On Jun 22, 3:27 pm, NickFranceschina 
wrote:
> OK... I had uploaded a 900+kb photo by mistake (thought I had uploaded
> 100k photo)
>
> also just realized that the schema for an "upload" Field on GAE
> includes an extra 'blob' type on the record (obviously, since we can't
> store files)... and my code was trying to convert records to JSON and
> blowing up... have to tell it to skip any 'blob' fields.
>
> working now!  thanks!!
>
> On Jun 22, 2:50 am, mdipierro  wrote:
>
>
>
> > You have something too large in the session and the datastore refuses
> > to store the session in the database.
>
> > On Jun 21, 11:32 pm, NickFranceschina 
> > wrote:
>
> > > I'm not sure what I'm doing wrong...   I've built a JSON service on
> > > top of Web2py that uses Auth.login_bare() to authenticate via
> > > AJAX...   my auth_user table looked like this (standard):
>
> > > auth.settings.table_user = db.define_table('auth_user',
> > >     Field('first_name', length=512,default='', required=True),
> > >     Field('last_name', length=512,default='', required=True),
> > >     Field('display_name', length=512,default='', required=True),
> > >     Field('email', length=512,default='',required=True,
> > >           requires = [IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
> > >     Field('password', 'password', readable=False, required=True,
> > >           label='Password',
> > >           requires=CRYPT(auth.settings.hmac_key)),
> > >     Field('registration_key', length=512,
> > >           writable=True, readable=True,default=''),
> > >     Field('reset_password_key', length=512,
> > >           writable=False, readable=False, default=''),
> > >     )
>
> > > but then I added this field to the auth_user table:
>
> > >     Field('photo', 'upload')
>
> > > and now it blows up on GAE at the moment it tries to do this (inside
> > > of login_bare):
>
> > >                 session.auth = Storage(user=user,
> > > last_visit=request.now,
>
> > > expiration=self.settings.expiration)
>
> > > with this error message:
>
> > > 'Traceback (most recent call last):\n  File "C:\\SVNs\\T4H\\Buttrcup\
> > > \www\\gluon\\main.py", line 391, in wsgibase\n
> > > session._try_store_in_db(request, response)\n  File "C:\\SVNs\\T4H\
> > > \Buttrcup\\www\\gluon\\globals.py", line 356, in _try_store_in_db\n
> > > table._db(table.id == record_id).update(**dd)\n  File "C:\\SVNs\\T4H\
> > > \Buttrcup\\www\\gluon\\contrib\\gql.py", line 744, in update\n
> > > item.put()\n  File "C:\\Program Files (x86)\\Google\\google_appengine\
> > > \google\\appengine\\ext\\db\\__init__.py", line 833, in put\n
> > > return datastore.Put(self._entity, rpc=rpc)\n  File "C:\\Program Files
> > > (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > > \datastore.py", line 282, in Put\n    \'datastore_v3\', \'Put\', req,
> > > datastore_pb.PutResponse(), rpc)\n  File "C:\\Program Files (x86)\
> > > \Google\\google_appengine\\google\\appengine\\api\\datastore.py", line
> > > 186, in _MakeSyncCall\n    rpc.check_success()\n  File "C:\\Program
> > > Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > > \apiproxy_stub_m

[web2py] Re: login_bare() blows up on GAE

2010-06-24 Thread NickFranceschina
yes that's what I'm saying... there must be some code in Web2py where
if the field is 'upload' and you're running on GAE, then it triggers
creation of the blob field... but probably shouldn't create the blob
in the same table, since on GAE there is no way to NOT load the blob
(it always loads the entire object)

maybe this isn't a big deal to GAE... it can handle alot... but it
requires my touching every object that has an upload field before
passing it back through JSON (have to set blob fields to null first)


On Jun 23, 2:50 am, mdipierro  wrote:
> > but as for automating the schema maintenance... if I create
> >   auth_user.Field('photo','upload')
> > instead of creating a 'photo' (string) and 'photo_blob' (blob) on the
> > same table, it should maybe create just 'photo' (string) and another
> > table called 'auth_user_photo' with one field and a reference?
>
> Field('photo','upload') is always a string. On GAE it also triggers
> the creation of a the blob field in the same table.


[web2py] GAE / Case sensitivity / canonical validator?

2010-06-25 Thread NickFranceschina
Massimo,

just realized that GQL does not allow for LOWER() or UPPER()... thus
cannot do case-insensitive searches.  the generally suggested solution
is to create another field and store the canonical form of the string
you're trying to search

example:
  person.name = "Nick Franceschina"
  person.canonical = "nick franceschina"


would be nice to have a validator that could do this automatically...
it would work like the IS_LOWER() validator, but would look into
another field for the data... something like:
  Field('canonical', 'string', requires=CANONICAL('person.name'))

then I just put my data into "name" as I always do, and wouldn't have
to write special code to do the canonical field...


is there anything like this now, and I'm not seeing it?  i'll keep
looking...

Thanks,
-Nick Franceschina


[web2py] dynamic tables / expando object / GAE

2010-06-25 Thread NickFranceschina
is it possible during runtime to create new table definitions and have
them executed?   so instead of putting my models in db.py, I could
pull the meta-data from a database and build the model on the fly when
the app starts up?  (if it is on SQL, it will do the usual maintenance
stuff... if it is on GAE it doesn't do anything)

I'd like to let users create their own "types"... on GAE this is easy
as there is no hard "schema" to follow... but I want the app to work
both on GAE and SQL (which is why I'm using Web2py)... so wondering
how that would work if I tried to define a table on the fly:

i.e.

default.py

  def index():

 fields = get_fields(); #returns a list of Field() objects
 tbl = db.define_table(mytable,fields)



Thank you,
-Nick Franceschina


[web2py] Re: GAE / Case sensitivity / canonical validator?

2010-06-29 Thread NickFranceschina
I'm not sure what the "like operator" has to do with this?

I guess what I'm talking about is using a validator to actually do the
work of an "autocompleted normalized field".   Much like the password
encryption validator.. or is_lower works... those validators actually
change the value of the field before storing it.  what I'm looking for
is a way to have a validator that will do an "IS_LOWER" on a different
field of the same record which would in essence BE a "hidden
autocomputed normalized field"

is there already a "hidden autocomputed normalized field"
functionality in Web2py?   could you point me towards it?


right now I have written separate code that computes the normalized/
canonical value and puts it in the other field... but I'd rather not
have this extra code at the app level... would be better to have it in
the model level so that it doesn't get overlooked by accident


Thanks!
-Nick Franceschina


On Jun 25, 5:38 pm, mdipierro  wrote:
> While it sould be easy to write such validator using the like
> operator, it would not be portable because it would not work on gae
> and would be slow in general. The preferred way is to use a hidden
> autocomputed normalized field.
>
> On Jun 25, 10:54 am, NickFranceschina 
> wrote:
>
>
>
> > Massimo,
>
> > just realized that GQL does not allow for LOWER() or UPPER()... thus
> > cannot do case-insensitive searches.  the generally suggested solution
> > is to create another field and store the canonical form of the string
> > you're trying to search
>
> > example:
> >   person.name = "Nick Franceschina"
> >   person.canonical = "nick franceschina"
>
> > would be nice to have a validator that could do this automatically...
> > it would work like the IS_LOWER() validator, but would look into
> > another field for the data... something like:
> >   Field('canonical', 'string', requires=CANONICAL('person.name'))
>
> > then I just put my data into "name" as I always do, and wouldn't have
> > to write special code to do the canonical field...
>
> > is there anything like this now, and I'm not seeing it?  i'll keep
> > looking...
>
> > Thanks,
> > -Nick Franceschina


[web2py] GAE / parents / ancestors in Web2py?

2010-06-29 Thread NickFranceschina
I've been reading and googling and searching... but not sure what the
latest, up-to-date information is on this:

in GAE "parents" and "references" are two different things.  when you
create an object in GAE you can, on insert, assign the "parent"... and
this puts the new object into the parents "entity group"... which lets
you:
 - use those objects within transactions in the entity group
 - do a query on an object and specify an "ancestor" (which can be
many many levels up the heirarchy, since the gae "key" actually
contains a composite of its entire entity group path, I think)

when it comes to transactions, I saw a few discussions that said we
can just use the native GAE transaction methods in order to run
transactions... but that doesn't really help unless we can assign
parents to our objects (thus creating these "entity groups").  I also
saw some discussions about implementing this feature of "parents"...
but I can't figure out if it exists yet.

I would really like to be able to use transactions and also do "has
ancestor" queries... but I think there's going to end up being a
disconnect on what is possible in both the the "big table" world and
the "SQL" world... making it difficult to make a single DAL be all
things


HOPEFULLY what I just wrote makes sense... I could very well be
completely confused and would love any feedback to help straighten me
out :)

Thank you,
-Nick Franceschina


[web2py] Wing IDE / GAE / breakpoints not getting hit for "exec" code

2010-07-02 Thread NickFranceschina
I've been using WingIDE pro for a while... love it... followed advice
to get it setup to work with Web2py and runs fine if I launch debugger
through web2py.py ... but if I launch it through dev_appserver.py then
the server runs and the app works and the breakpoints are hit for all
code except for the controller code because, apparently, it is called
via python "exec" method...

this works fine through web2py's web server... but not through
dev_appserver ... for me anyways

What am I doing wrong?

Thank you!
-Nick Franceschina


[web2py] Re: GAE / parents / ancestors in Web2py?

2010-07-02 Thread NickFranceschina
anybody?

On Jun 29, 10:03 pm, NickFranceschina 
wrote:
> I've been reading and googling and searching... but not sure what the
> latest, up-to-date information is on this:
>
> in GAE "parents" and "references" are two different things.  when you
> create an object in GAE you can, on insert, assign the "parent"... and
> this puts the new object into the parents "entity group"... which lets
> you:
>  - use those objects within transactions in the entity group
>  - do a query on an object and specify an "ancestor" (which can be
> many many levels up the heirarchy, since the gae "key" actually
> contains a composite of its entire entity group path, I think)
>
> when it comes to transactions, I saw a few discussions that said we
> can just use the native GAE transaction methods in order to run
> transactions... but that doesn't really help unless we can assign
> parents to our objects (thus creating these "entity groups").  I also
> saw some discussions about implementing this feature of "parents"...
> but I can't figure out if it exists yet.
>
> I would really like to be able to use transactions and also do "has
> ancestor" queries... but I think there's going to end up being a
> disconnect on what is possible in both the the "big table" world and
> the "SQL" world... making it difficult to make a single DAL be all
> things
>
> HOPEFULLY what I just wrote makes sense... I could very well be
> completely confused and would love any feedback to help straighten me
> out :)
>
> Thank you,
> -Nick Franceschina


[web2py] GAE/Jython

2010-07-11 Thread NickFranceschina
anyone running Web2py with Jython on GAE?   just wondering...


[web2py] Re: Wing IDE / GAE / breakpoints not getting hit for "exec" code

2010-07-12 Thread NickFranceschina
after going back and forth a bit with WING support guys... it appears
to be an issue with Web2py...


on line 388 of compileapp.py there are two lines of code that only run
on GAE... which essentially cache the compiled? code file using
filename + ':' + key... where key is the function name.  this ccode
object then gets executed with a path of (this is my test example):

  "C:\SVNs\T4H\Buttrcup\www\applications\init\controllers
\default.py:test"


Since this is an invalid path, if there are any breakpoints set in the
controller, Wing cannot hit them because it doesn't know where this
file is.  If I comment out the GAE caching function, then Wing hits
its breakpoints correctly.



if this is not a bug, and there is some other configuration settings I
should be doing in order to debug with Wing, would someone kindly
inform me?


Thank you much,
-Nick Franceschina







On Jul 2, 12:55 pm, NickFranceschina 
wrote:
> I've been using WingIDE pro for a while... love it... followed advice
> to get it setup to work with Web2py and runs fine if I launch debugger
> through web2py.py ... but if I launch it through dev_appserver.py then
> the server runs and the app works and the breakpoints are hit for all
> code except for the controller code because, apparently, it is called
> via python "exec" method...
>
> this works fine through web2py's web server... but not through
> dev_appserver ... for me anyways
>
> What am I doing wrong?
>
> Thank you!
> -Nick Franceschina


[web2py] Re: Wing IDE / GAE / breakpoints not getting hit for "exec" code

2010-07-13 Thread NickFranceschina
thanks but this doesn't help me...
  1) I'm using Wing
  2) I'm trying to debug using GAE's dev_appserver.py

Wing debugs fine if I use web2py's web server... but when run on GAE,
Web2py has that extra code to cache files by key... and the path gets
screwed up.  Are you debugging against GAE's dev_appserver.py?I
would venture a guess that if you were, you'd see the same problem??





On Jul 12, 11:19 pm, Phyo Arkar  wrote:
> In Pydev every debugging is working very well if you follow this web2py
> slice by mr.freeze:www.web2pyslices.com/main/slices/take_slice/2
>
> May be setting it up in Mercurial way as shown in above slice,  inside
> WingIDE  can make Web2py debug well as whole server is run through IDE's
> debugger. But i dont know if it supports Mercurial.
>
> I dont use WingIDE (coz Pydev have better completions, current version works
> almost all Completions in web2py ).
>
> On Mon, Jul 12, 2010 at 9:48 PM, NickFranceschina <
>
>
>
> nickfrancesch...@gmail.com> wrote:
> > after going back and forth a bit with WING support guys... it appears
> > to be an issue with Web2py...
>
> > on line 388 of compileapp.py there are two lines of code that only run
> > on GAE... which essentially cache the compiled? code file using
> > filename + ':' + key... where key is the function name.  this ccode
> > object then gets executed with a path of (this is my test example):
>
> >  "C:\SVNs\T4H\Buttrcup\www\applications\init\controllers
> > \default.py:test"
>
> > Since this is an invalid path, if there are any breakpoints set in the
> > controller, Wing cannot hit them because it doesn't know where this
> > file is.  If I comment out the GAE caching function, then Wing hits
> > its breakpoints correctly.
>
> > if this is not a bug, and there is some other configuration settings I
> > should be doing in order to debug with Wing, would someone kindly
> > inform me?
>
> > Thank you much,
> > -Nick Franceschina
>
> > On Jul 2, 12:55 pm, NickFranceschina 
> > wrote:
> > > I've been using WingIDE pro for a while... love it... followed advice
> > > to get it setup to work with Web2py and runs fine if I launch debugger
> > > through web2py.py ... but if I launch it through dev_appserver.py then
> > > the server runs and the app works and the breakpoints are hit for all
> > > code except for the controller code because, apparently, it is called
> > > via python "exec" method...
>
> > > this works fine through web2py's web server... but not through
> > > dev_appserver ... for me anyways
>
> > > What am I doing wrong?
>
> > > Thank you!
> > > -Nick Franceschina


[web2py] Re: Wing IDE / GAE / breakpoints not getting hit for "exec" code

2010-07-25 Thread NickFranceschina
bump

On Jul 13, 11:20 am, NickFranceschina 
wrote:
> thanks but this doesn't help me...
>   1) I'm using Wing
>   2) I'm trying to debug using GAE's dev_appserver.py
>
> Wing debugs fine if I use web2py's web server... but when run on GAE,
> Web2py has that extra code to cache files by key... and the path gets
> screwed up.  Are you debugging against GAE's dev_appserver.py?    I
> would venture a guess that if you were, you'd see the same problem??
>
> On Jul 12, 11:19 pm, Phyo Arkar  wrote:
>
>
>
> > In Pydev every debugging is working very well if you follow this web2py
> > slice by mr.freeze:www.web2pyslices.com/main/slices/take_slice/2
>
> > May be setting it up in Mercurial way as shown in above slice,  inside
> > WingIDE  can make Web2py debug well as whole server is run through IDE's
> > debugger. But i dont know if it supports Mercurial.
>
> > I dont use WingIDE (coz Pydev have better completions, current version works
> > almost all Completions in web2py ).
>
> > On Mon, Jul 12, 2010 at 9:48 PM, NickFranceschina <
>
> > nickfrancesch...@gmail.com> wrote:
> > > after going back and forth a bit with WING support guys... it appears
> > > to be an issue with Web2py...
>
> > > on line 388 of compileapp.py there are two lines of code that only run
> > > on GAE... which essentially cache the compiled? code file using
> > > filename + ':' + key... where key is the function name.  this ccode
> > > object then gets executed with a path of (this is my test example):
>
> > >  "C:\SVNs\T4H\Buttrcup\www\applications\init\controllers
> > > \default.py:test"
>
> > > Since this is an invalid path, if there are any breakpoints set in the
> > > controller, Wing cannot hit them because it doesn't know where this
> > > file is.  If I comment out the GAE caching function, then Wing hits
> > > its breakpoints correctly.
>
> > > if this is not a bug, and there is some other configuration settings I
> > > should be doing in order to debug with Wing, would someone kindly
> > > inform me?
>
> > > Thank you much,
> > > -Nick Franceschina
>
> > > On Jul 2, 12:55 pm, NickFranceschina 
> > > wrote:
> > > > I've been using WingIDE pro for a while... love it... followed advice
> > > > to get it setup to work with Web2py and runs fine if I launch debugger
> > > > through web2py.py ... but if I launch it through dev_appserver.py then
> > > > the server runs and the app works and the breakpoints are hit for all
> > > > code except for the controller code because, apparently, it is called
> > > > via python "exec" method...
>
> > > > this works fine through web2py's web server... but not through
> > > > dev_appserver ... for me anyways
>
> > > > What am I doing wrong?
>
> > > > Thank you!
> > > > -Nick Franceschina