[web2py] Key query support in Google App Engine

2010-06-09 Thread Christian Foster Howes

Hi all,

attached is a patch for gql.py.  Please review and Massimo, if people 
like this, can we add it to trunk?


what does it do?  it allows you to do key queries on Google App Engine. 
 this means that you can now perform all ID queries on tables in google 
app engine.  for example:


belongs = db(db.test_tbl.id.belongs([69126,69127])).select()
eq = db(db.test_tbl.id==69126).select()
neq = db(db.test_tbl.id!=69126).select()
lt = db(db.test_tbl.id<69126).select()
gt = db(db.test_tbl.id>69126).select()
lte = db(db.test_tbl.id<=69126).select()
gte = db(db.test_tbl.id>=69126).select()
all = db(db.test_tbl.id>0).select()

it also adds "__key__" to _extra on each row in the result...just in 
case you really wanted to see that google key.


if i missed some test cases please let me know and i'll verify them as well.

thanks!

Christian
diff -r 52be2b542a3c gluon/contrib/gql.py
--- a/gluon/contrib/gql.py	Wed Jun 09 10:52:12 2010 -0500
+++ b/gluon/contrib/gql.py	Wed Jun 09 20:48:24 2010 -0700
@@ -27,6 +27,7 @@
 import gluon.sql
 from new import classobj
 from google.appengine.ext import db as gae
+from google.appengine.api.datastore_types import Key
 
 MAX_ITEMS = 1000 # GAE main limitation
 
@@ -531,12 +532,33 @@
 # normal filter: field op value
 assert_filter_fields(left)
 if left.type == 'id':
+  #if the name is also id, treat it like an long
+  if left.name == 'id':
 try:
-right = long(right or 0)
+if type(right) == list:
+#make this work for belongs
+right = [long(r) for r in right]
+else:
+right = long(right or 0)
 except ValueError:
 raise SyntaxError, 'id value must be integer: %s' % id
-if not (op == '=' or (op == '>' and right == 0)):
-raise RuntimeError, '(field.id  value) is not supported on GAE'
+if op != '=' and not (op == '>' and right == 0):
+#in this case we need to go a GAE __key__ query.  change the
+# name for query generation (we change the name back after the
+# query is generated)
+left.name="__key__"
+#get key (or keys) based on path.  Note if we later support
+# ancesters this will not be the proper key for items with
+# ancesters.
+if op=='IN':
+right = [Key.from_path(left._tablename, r) for r in right]
+else:
+right = Key.from_path(left._tablename, right)
+  else:
+#this most likely means that the user created a field called
+# __key__ that they want to use to do a query with a known
+# key
+right = Key(str(right or 0))
 elif op=='IN':
 right = [dateobj_to_datetime(obj_represent(r, left.type, left._db)) \
  for r in right]
@@ -667,6 +689,11 @@
 (limit, offset) = (lmax - lmin, lmin)
 items = items.fetch(limit, offset=offset)
 fields = self._db[tablename].fields
+
+#change the id name back to id from __key__ used in the query
+id_field = self._db[tablename]['id']
+id_field.name='id'
+
 return (items, tablename, fields)
 
 def select(self, *fields, **attributes):
@@ -683,10 +710,17 @@
 for t in fields:
 if t == 'id':
 new_item.append(int(item.key().id()))
+elif t == '__key__':
+#actually want the key value from GAE
+new_item.append(item.key())
 else:
 new_item.append(getattr(item, t))
+#add the key so it will be in _extra for the result
+new_item.append(item.key())
 rows.append(new_item)
 colnames = ['%s.%s' % (tablename, t) for t in fields]
+#add __key__ name to extra
+colnames.append('__key__')
 return self.parse(self._db, rows, colnames, False, SetClass=Set)
 
 @staticmethod


[web2py] Re: Key query support in Google App Engine

2010-06-10 Thread Christian Foster Howes

Here is a new version of the patch to address the issues:

 - no more __key__ in _extra (and in understand why it breaks backward 
compatibility nowjust needed to think about it)
 - since it is illegal in web2py to have "_" start a field name, 
"__key__" can never be a field name and never queried on.  so removed 
the support that i had tried to add in my previous version of the patch
 - since previously web2py required that id on GAE be a long, i 
continued that theme, which simplifies the code.  basically the id>0 and 
id==x case were already special cases in the code, if you use any other 
operators on ID this version of the code detects field.type=='id' and 
will use "__key__" in the query (regardless of the name you have 
assigned your key, and with out my changing the name hack)


hopefully you agree that this is better, and thanks for your patience 
and code review!  let me know if there are any other changes that i 
should make.


christian


On 06/09/2010 08:54 PM, Christian Foster Howes wrote:

Hi all,

attached is a patch for gql.py. Please review and Massimo, if people
like this, can we add it to trunk?

what does it do? it allows you to do key queries on Google App Engine.
this means that you can now perform all ID queries on tables in google
app engine. for example:

belongs = db(db.test_tbl.id.belongs([69126,69127])).select()
eq = db(db.test_tbl.id==69126).select()
neq = db(db.test_tbl.id!=69126).select()
lt = db(db.test_tbl.id<69126).select()
gt = db(db.test_tbl.id>69126).select()
lte = db(db.test_tbl.id<=69126).select()
gte = db(db.test_tbl.id>=69126).select()
all = db(db.test_tbl.id>0).select()

it also adds "__key__" to _extra on each row in the result...just in
case you really wanted to see that google key.

if i missed some test cases please let me know and i'll verify them as
well.

thanks!

Christian
diff -r 52be2b542a3c gluon/contrib/gql.py
--- a/gluon/contrib/gql.py	Wed Jun 09 10:52:12 2010 -0500
+++ b/gluon/contrib/gql.py	Thu Jun 10 07:22:08 2010 -0700
@@ -27,6 +27,7 @@
 import gluon.sql
 from new import classobj
 from google.appengine.ext import db as gae
+from google.appengine.api.datastore_types import Key
 
 MAX_ITEMS = 1000 # GAE main limitation
 
@@ -532,11 +533,24 @@
 assert_filter_fields(left)
 if left.type == 'id':
 try:
-right = long(right or 0)
+if type(right) == list:
+#make this work for belongs
+right = [long(r) for r in right]
+else:
+right = long(right or 0)
 except ValueError:
 raise SyntaxError, 'id value must be integer: %s' % id
-if not (op == '=' or (op == '>' and right == 0)):
-raise RuntimeError, '(field.id  value) is not supported on GAE'
+if op != '=' and not (op == '>' and right == 0):
+#get key (or keys) based on path.  Note if we later support
+# ancesters this will not be the proper key for items with
+# ancesters.
+#in GAE (with no ancesters) the key is base64 encoded
+# "table_name: id=".  GAE decodes the string and compares
+# the id
+if op=='IN':
+right = [Key.from_path(left._tablename, r) for r in right]
+else:
+right = Key.from_path(left._tablename, right)
 elif op=='IN':
 right = [dateobj_to_datetime(obj_represent(r, left.type, left._db)) \
  for r in right]
@@ -634,20 +648,27 @@
 self.where = Query(fields[0].table.id,'>',0)
 for filter in self.where.filters:
 if filter.all():
+#this is id > 0
 continue
 elif filter.one() and filter.right<=0:
+#this is id == 0
 items = []
 elif filter.one():
+#this is id == x
 item = self._db[tablename]._tableobj.get_by_id(filter.right)
 items = (item and [item]) or []
 elif isinstance(items,list):
-(name, op, value) = (filter.left.name, filter.op, filter.right)
+(name, op, value) = \
+   (filter.left.name if filter.left.type!='id' else '__key__',
+filter.op, filter.right)
 if op == '=': op = '=='
 if op == 'IN': op = 'in'
 items = [item for item in items \
  if eval("getattr(ite

[web2py] Re: Key query support in Google App Engine

2010-06-11 Thread Christian Foster Howes
Did some more testing today...i left out the corrections for orderby. 
the attached patch includes that bit as well.  sorry for the extra file.


i don't think there are any other clauses that you can put ID in, is 
that correct?


also, if anyone is using GAE development server with sqlite, key queries 
don't work properly there (spent 4 hours trying to figure out what i 
messed up to find out that others reported it as a bug to google).


christian

On 06/09/2010 08:54 PM, Christian Foster Howes wrote:

Hi all,

attached is a patch for gql.py. Please review and Massimo, if people
like this, can we add it to trunk?

what does it do? it allows you to do key queries on Google App Engine.
this means that you can now perform all ID queries on tables in google
app engine. for example:

belongs = db(db.test_tbl.id.belongs([69126,69127])).select()
eq = db(db.test_tbl.id==69126).select()
neq = db(db.test_tbl.id!=69126).select()
lt = db(db.test_tbl.id<69126).select()
gt = db(db.test_tbl.id>69126).select()
lte = db(db.test_tbl.id<=69126).select()
gte = db(db.test_tbl.id>=69126).select()
all = db(db.test_tbl.id>0).select()

it also adds "__key__" to _extra on each row in the result...just in
case you really wanted to see that google key.

if i missed some test cases please let me know and i'll verify them as
well.

thanks!

Christian
diff -r e21076a9427b gluon/contrib/gql.py
--- a/gluon/contrib/gql.py	Thu Jun 10 22:48:53 2010 -0500
+++ b/gluon/contrib/gql.py	Fri Jun 11 00:29:17 2010 -0700
@@ -27,6 +27,7 @@
 import gluon.sql
 from new import classobj
 from google.appengine.ext import db as gae
+from google.appengine.api.datastore_types import Key
 
 MAX_ITEMS = 1000 # GAE main limitation
 
@@ -297,7 +298,7 @@
 
 def __or__(self, other):  # for use in sortby
 assert_filter_fields(self, other)
-return Expression(self.name + '|' + other.name, None, None)
+return Expression(self.name if self.type!='id' else '__key__' + '|' + other.name if other.type!='id' else '__key__', None, None)
 
 def __invert__(self):
 assert_filter_fields(self)
@@ -532,11 +533,24 @@
 assert_filter_fields(left)
 if left.type == 'id':
 try:
-right = long(right or 0)
+if type(right) == list:
+#make this work for belongs
+right = [long(r) for r in right]
+else:
+right = long(right or 0)
 except ValueError:
 raise SyntaxError, 'id value must be integer: %s' % id
-if not (op == '=' or (op == '>' and right == 0)):
-raise RuntimeError, '(field.id  value) is not supported on GAE'
+if op != '=' and not (op == '>' and right == 0):
+#get key (or keys) based on path.  Note if we later support
+# ancesters this will not be the proper key for items with
+# ancesters.
+#in GAE (with no ancesters) the key is base64 encoded
+# "table_name: id=".  GAE decodes the string and compares
+# the id
+if op=='IN':
+right = [Key.from_path(left._tablename, r) for r in right]
+else:
+right = Key.from_path(left._tablename, right)
 elif op=='IN':
 right = [dateobj_to_datetime(obj_represent(r, left.type, left._db)) \
  for r in right]
@@ -634,20 +648,29 @@
 self.where = Query(fields[0].table.id,'>',0)
 for filter in self.where.filters:
 if filter.all():
+#this is id > 0
 continue
 elif filter.one() and filter.right<=0:
+#this is id == 0
 items = []
 elif filter.one():
+#this is id == x
 item = self._db[tablename]._tableobj.get_by_id(filter.right)
 items = (item and [item]) or []
 elif isinstance(items,list):
-(name, op, value) = (filter.left.name, filter.op, filter.right)
+(name, op, value) = \
+   (filter.left.name if filter.left.type!='id' else '__key__',
+filter.op, filter.right)
 if op == '=': op = '=='
 if op == 'IN': op = 'in'
 items = [item for item in items \
  if eval("getattr(item,'%s') %s %s" % (name, op, repr(value)))]
 else:
-(name, op, value)

[web2py] plugin_wiki and auth tables

2010-10-04 Thread Christian Foster Howes

Massimo et. al.,

Can we update plugin_wiki to use the auth settings for auth table names? 
 Since i have not looked into implementing table namespaces on GAE yet, 
i rename all my tables with an application prefix so applications don't 
mix data.  when i do that plugin_wiki is not so happy.


I don't think there is a source repository for plugin_wiki, so the 
attached diff is based off of a download from web2py on Thursday Sept 30.


Thanks,

Christian
diff -r c9821604e151 web2py/applications/test/models/plugin_wiki.py
--- a/web2py/applications/test/models/plugin_wiki.pyFri Oct 01 13:19:23 
2010 -0700
+++ b/web2py/applications/test/models/plugin_wiki.pyMon Oct 04 12:09:00 
2010 -0700
@@ -53,17 +53,17 @@
 Field('active','boolean',default=True),
 Field('public','boolean',default=True),
 Field('body','text',default=''),
-Field('role',db.auth_group,
-  
requires=IS_EMPTY_OR(IS_IN_DB(db,'auth_group.id','%(role)s'))),
+Field('role',auth.settings.table_group,
+  
requires=IS_EMPTY_OR(IS_IN_DB(db,'%s.id'%auth.settings.table_group_name,'%(role)s'))),
 Field('changelog',default=''),
 Field('created_by',
-  db.auth_user,default=auth.user_id,
+  auth.settings.table_user,default=auth.user_id,
   writable=False,readable=False),
 Field('created_on','datetime',
   default=request.now,
   writable=False,readable=False),
 Field('modified_by',
-  db.auth_user,default=auth.user_id,update=auth.user_id,
+  
auth.settings.table_user,default=auth.user_id,update=auth.user_id,
   writable=False,readable=False),
 Field('modified_on','datetime',
   default=request.now,update=request.now,
@@ -83,13 +83,13 @@
 Field('name',requires=IS_NOT_EMPTY()),
 Field('file','upload',requires=IS_NOT_EMPTY(),autodelete=True),
 Field('created_by',
-  db.auth_user,default=auth.user_id or 1,
+  auth.settings.table_user,default=auth.user_id or 1,
   writable=False,readable=False),
 Field('created_on','datetime',
   default=request.now,
   writable=False,readable=False),
 Field('modified_by',
-  db.auth_user,default=auth.user_id,update=auth.user_id,
+  
auth.settings.table_user,default=auth.user_id,update=auth.user_id,
   writable=False,readable=False),
 Field('modified_on','datetime',
   default=request.now,update=request.now,
@@ -103,7 +103,7 @@
 Field('record_id','integer',
   writable=False,readable=False),
 Field('body',requires=IS_NOT_EMPTY(),label='Your comment'),
-Field('created_by',db.auth_user,default=auth.user_id,
+
Field('created_by',auth.settings.table_user,default=auth.user_id,
   readable=False,writable=False),
 Field('created_on','datetime',default=request.now,
   readable=False,writable=False), 
migrate=plugin_wiki_migrate)
@@ -112,7 +112,7 @@
 db.define_table('plugin_wiki_tag',
 Field('name',requires=IS_NOT_IN_DB(db,'plugin_wiki_tag.name')),
 Field('links','integer',default=0,writable=False),
-Field('created_by',db.auth_user,writable=False,readable=False,
+
Field('created_by',auth.settings.table_user,writable=False,readable=False,
   default=auth.user_id),
 Field('created_on','datetime',
   default=request.now,writable=False,readable=False),
@@ -433,7 +433,7 @@
 
 @staticmethod
 def 
map(key='ABQIT5em2PdsvF3z5onQpCqv0RTpH3CbXHjuCVmaTc5MkkU4wO1RRhQHEAKj2S9L72lEMpvNxzLVfJt6cg',
-table='auth_user', width=400, height=200):
+table=auth.settings.table_user_name, width=400, height=200):
 """
 ## Embeds a Google map
 Gets points on the map from a table


[web2py] Auth forms and formstyle

2010-10-13 Thread Christian Foster Howes

Massimo,

it seems the reset_password and change_password forms are not adhearing 
to the formstyle setting.  can you review and apply the attached patch 
if appropriate?


thanks,

christian
diff -r ee8db10779ad gluon/tools.py
--- a/gluon/tools.pyWed Oct 13 09:51:52 2010 -0500
+++ b/gluon/tools.pyWed Oct 13 11:44:16 2010 -0700
@@ -1908,7 +1908,8 @@
   label=self.messages.verify_password,
   requires=[IS_EXPR('value==%s' % 
repr(request.vars.new_password),
 self.messages.mismatched_password)]),
-submit_button=self.messages.submit_button
+submit_button=self.messages.submit_button,
+formstyle=self.settings.formstyle
 )
 if 
form.accepts(request.post_vars,session,hideerror=self.settings.hideerror):
 user.update_record(**{passfield:form.vars.new_password,
@@ -2063,7 +2064,8 @@
 label=self.messages.verify_password,
 requires=[IS_EXPR('value==%s' % 
repr(request.vars.new_password),
   self.messages.mismatched_password)]),
-submit_button=self.messages.submit_button
+submit_button=self.messages.submit_button,
+formstyle=self.settings.formstyle
 )
 if form.accepts(request.post_vars, session,
 formname='change_password',


Re: [web2py] Re: Keys and GAE

2011-01-10 Thread Christian Foster Howes

Matt,

so now i understand completely.  thanks for the clarification.

this may be crazy talk, so hopefully those closer to the DAL will weigh 
in here, but take a look at line select_raw of dal.py (i don't have a 
line number since i have all modified versions, it's around 2670):


elif filter.name=='__key__' and filter.op=='=':
if filter.value==0:
items = []
else:
item = tableobj.get_by_id(filter.value)
items = (item and [item]) or []

here is where the db(db.address.id == 42) gets put together.  I'm making 
the assumption you would only do == queries, and that you might like 
something this for your query:

   db(db.address.id == [, ]

which gets put into the dal code block like:

elif filter.name=='__key__' and filter.op=='=':
if filter.value==0:
items = []
if isinstance(filter.value, list):
key = Key.from_path(filter.value[0].tablename, #get 
table name here somehow

filter.value[0].id,
tablename, filter.value[1],
else:
item = tableobj.get_by_id(filter.value)
items = (item and [item]) or []

NOTE: i have not tested or even run this code.  just a suggestion on 
what it might look like.


there is also this thread: 
https://groups.google.com/forum/#!topic/web2py/WNDXVNNUyQ8  but it does 
not model parents quite like GAE would by default.


cfh


On 01/10/2011 06:21 PM, Matt wrote:

Hi Christian,

Thanks for your response.

In order to save my entities (as part of an entity group) I've had to
set the parent of the 'address' to be the 'user'. That way I can use a
transaction to persist these multiple entities in one go.

I.e. assuming:

db.define_table('user',
db.Field('name', 'string'))

db.define_table('address',
db.Field('street', 'string'))

In my code (more or less):

from google.appengine.ext import db as gae

def txn(name, street):
user = db.user._tableobj(name=name)
address = db.address._tableobj(parent=user, street=street)
user.put()
address.put()

gae.run_in_transaction(txn, name='Barry', street='Whatever')

Now since I've used a parent for the address I can't do queries using
the DAL like:

address = db.address(addressId)

or

address = db.address(db.address.id == addressId) etc.

As it always returns None as the "key" for this entity is now composed
of itself plus it's parent. Which I have no way to specify.

So hence I have to step outside of web2py to retrieve records using
raw GQL calls and means that I lose nice web2py features like:

Inside my html:

{{= address.user.name }}

Does that make sense?

Ideally I'd like to be able to construct the key and compare it like
any other field.

Perhaps a custom GAE method to support this could be added to the
core?

Cheers,
Matt


On Jan 11, 12:55 pm, howesc  wrote:

I must admit i'm not following your example.  why do you need to query by
GAE __key__ rather than by ID?  (i have not used ancestors in GAE so maybe
that is why i'm mis-understanding).

but your reference to my previous exchange made me look at this in the new
DAL - and the !=,<,>,<=, and>= queries are broken again on GAE.  I'll
work on putting a patch together for that since i did it before.  if you
help me understand your problem better perhaps i can help get you the
solution that you need.

thanks,

christian





Re: [web2py] Re: doesn't represents in a string format

2011-01-18 Thread Christian Foster Howes
the requires my not be necessary, i have not tested it.  when i have the 
represent it works for me in SQLTABLE.  i have not used the other 
visualizations.


On 01/18/2011 05:08 AM, web2py noob wrote:

I have to say that the represent=lambda x: db.stuff[x].name seems to
works only for webgrid plugin, but not for jqgrid (plugin_wiki) nor
SQLTABLE builtin function. it's this how is must be or is a bug?




Re: [web2py] User accessed site without logging in

2012-07-28 Thread Christian Foster Howes
yes i use current in modules, when i get back to testing this and have 
some details worth reporting i'll open a ticket.


this is all that i have right now: 
https://groups.google.com/forum/?fromgroups&pli=1#!topic/web2py/aaG7YK7fddg


thanks,

cfh

On 7/24/12 14:55 , Massimo Di Pierro wrote:

Is there an open issue about this? If not, can you open one with more
details?


On Tuesday, 24 July 2012 16:31:52 UTC-5, howesc wrote:


one other scenario..

i reported a few months back that running web2py on GAE with python2.7 and
multi-threading had odd behaviors with the globals (request, response,
session).  i have yet tracked down the issues i was having (might have been
a coding error on my part).but if you are using GAE + multithreading
i'd be interested to know that.

cfh

On Tuesday, July 24, 2012 1:26:21 PM UTC-7, Massimo Di Pierro wrote:


Perhaps it would be safe to block access to the site if request.client is
"unknown".
I think we should change web2py to block access to any web2py app if
request.client does not validate as an IP address.

Massimo

On Tuesday, 24 July 2012 15:24:06 UTC-5, Massimo Di Pierro wrote:


Here is a possible cause of the problem although I am not sure.
There are two possible issues which may conspire to create this problem.

Issue #1
===

There is a session file in the app you sent me called:

 unknown-c4571a37...

session files should be

 -.

This means that one of the HEADERS http_x_forwarded_for or remote_addr
has a value "unknown".

A first google search retuned:
http://nixforums.org/about154671-Hacking-X-Forwarded-For.html
which opens the possibility the the web server, in your case nginx, is
not finding the client ip address (how is that possible) and setting it to
unknown. This should never happen. The client_addr is a required field for
WSGI.

This could be the result of a hacking attempt but it would required both
parties doing the hacking for the sessions to be mixed up.

Issue #2
===

There is a bug with may prevent urandom from working:


http://community.webfaction.com/questions/9333/importerror-cannot-import-name-urandom

http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django

Can you check if you can import urandom on your version of python on
webfaction?


It is therefore theoretically possible that, given the concurrency model
of nginx, if two users visit the site very close to each other, with
urandom missing, both declaring the same incorrect client ip (unknown),
they get assigned the same session id. This is because web2py has no way of
distinguishing the two users and lacks a proper random number generator.

TODO:

1) check if you can import urandom
2) try understand how it possible to have an "unkown" client_addr in the
http headers.

My google search returned nothing about 2. Has anybody ever seen this
before?
Please let us know.









On Tuesday, 24 July 2012 14:50:04 UTC-5, Massimo Di Pierro wrote:


Nothing stands out from your code. It is very good code. You have
changed to gluon/tools.py but I do not think they can be causing this
problem.

On Tuesday, 24 July 2012 14:48:16 UTC-5, Massimo Di Pierro wrote:


I should add that the conflict I mentioned below is not possible
unless there is a proxy in between. That is because the session id includes
the client IP.

I really do not see how this problem can be possible. Are you sure
they are not playing a prank on you? If they share a facebook page perhaps
they know each other. I have to ask but we will keep investigating the
issue very seriously nevertheless.

For now I suggest you add this to your code:

if auth.user:
session.clients = session.clients or []
if not request.client in session.clients:
session.clients.append(request.client)
if len(session.clients)>1: print auth.user.email, session.clients

log the output and check how often you have multiple session.clients
for the same email from different network top level domains (xxx.*.*.*) If
you do, email the user and check what is going on with them.

Massimo




On Tuesday, 24 July 2012 14:26:35 UTC-5, Massimo Di Pierro wrote:


The only time I have seen something like this was long age. Web2py
was running on replicated VMs behing a load balancer. If two requests from
new users arrived within a short time frame (do not remember if a
millisecond or a second), they were assigned the same session uuid because
uuid.uuid4() could not discriminate between the VMs. We fixed it by make
uuid dependent on the os entropy source urandom and initializing it
differently on different VMs using the IP address. The fix works on
linux/unix but not on Windows. Replicated windows machine may suffer from
this problem still.

What is the web server and configuration in your case?
Do you know what  was the link that caused the problem?
Which page she was directed too?

massimo

On Tuesday, 24 July 2012 10:18:46 UTC-5, Jonathan Lundell wrote:


On 24 Jul 2012, at 6:41 AM, Neil wrote:

Good poin

Re: [web2py] Re: Appengine CPU cycles

2012-08-07 Thread Christian Foster Howes
when i last tested it it was with a very complex custom auth + 
validators.  there are probably ways to trim it down.  one thing that i 
did was only init mail and attach mail to auth if i was doing something 
that required mail.


cfh

On 8/7/12 6:45 , Alexei Vinidiktov wrote:

The app I'm developing is highly dependent on auth.

Does it mean that any request that uses auth won't be faster than 200ms on
GAE?

On Tue, Aug 7, 2012 at 7:30 AM, howesc  wrote:


are you using auth?  auth takes around 200ms to load i think on GAE.  i
avoid initializing auth except for the controllers that use it, as well as
having my model definitions in modules.

cfh


On Monday, August 6, 2012 3:57:51 PM UTC-7, Felipe Meirelles wrote:


Actualy Django uses the datastore too. I'm using the memcache for all
things its possible (it already reduce the old django version database
access on 90% in this new web2py version).

I think the overhead is realy from loading all models, grids and menus
I've defined for my app. I'll try a Model less aproch, but tying to right a
less complex code, using most of the web2py api as possible.

As soon as I finish, I'll post here (:

Thank you all.

On Monday, August 6, 2012 7:50:59 PM UTC-3, Massimo Di Pierro wrote:


You should check the {{=response.toolbar()}} because there may be more
DB io than you think in the models.

You should also try remove the setting of model attributes (requires=,
models=, ...) and move them in the controllers that need them.

Also mind that web2py on GAE has sessions turned on by default and they
are stored and retrieved from datastore.

I do not know how Django stores sessions on GAE by default.

massimo






On Monday, 6 August 2012 14:19:35 UTC-5, Felipe Meirelles wrote:


Without any model I have a huge drop on the cpu use, from around 300ms
to around 60ms. Still higher than with Django, but its acceptable by the
concept of the framework.
Ill make some debug on my models and update the topic.

On Monday, August 6, 2012 4:05:56 PM UTC-3, rochacbruno wrote:


What do you have in models?

All model files runs alphabetically for each request, so we need to
know what are you doing on model files.

Can you try to test with an empty brand new app, remove all files from
models folder and try your simple controller

import logging

def test():
 logging.info("Just making a performace test")

Makes difference?



On Mon, Aug 6, 2012 at 3:59 PM, Felipe Meirelles <
fel...@felipemeirelles.com.br**> wrote:


Even the simplest controller give me a high cpu usage:

import logging

def test():
 logging.info("Just making a performace test")


ms=559 cpu_ms=612 api_cpu_ms=245


On Monday, August 6, 2012 3:37:38 PM UTC-3, Felipe Meirelles wrote:


Just compiled the app and deployed again, seems to make no
diference. App engine uses the bytecode generated on web2py? Did I need to
change some config at app.yaml?

On Monday, August 6, 2012 3:21:29 PM UTC-3, Felipe Meirelles wrote:


Pre compiled by the admin interface? Not yet, is there some impove
with the precompiled code?

On Mon, Aug 6, 2012 at 3:16 PM, Derek  wrote:


Have you compiled your app?

On Monday, August 6, 2012 10:46:33 AM UTC-7, Felipe Meirelles
wrote:


Hi,

I'm using web2py in a project that stands on top of a REST api.
The project is write intensive (around 110k requests a day, with all the
requests making at least 2 updates to the datastore).
All my requests seems to uso at least 200 cpu_ms (even dummy
requests that only places a item on the queue to be processeced later). Is
this behaviour right? I used to get around 20 cpu_ms while using django
with the same application (I'm currently re-writing it on web2py).
Is there some way to optimize web2py for a appengine deploy (I
already followed all the documentation)

Thanks!


  --








--
Att,
Felipe Meirelles.

   --







  --











--





Re: [web2py] Re: Web2py GAE strange error [Errno 13] file not accessible: (jQuery.js)

2012-08-17 Thread Christian Foster Howes
db, auth, response was getting overwritten mid-request.  see 
https://groups.google.com/forum/?fromgroups#!topic/web2py/aaG7YK7fddg[1-25]


On 8/17/12 19:49 , Massimo Di Pierro wrote:

What kind of thread problems did you have on GAE?

On Friday, 17 August 2012 16:23:17 UTC-5, howesc wrote:


response.include_file() outputs the files that were added to
response.files (js, css).  when you remove that you loose the auto output
of files that were added to response.files along the way.

response.include_mete() works much the same for HTML meta properties.

can we see the resulting HTML in both cases?  in the first case (when it
fails completely) you get HTML right?  but jquery.js fails to load so other
things on your site might break.  in the second case it sounds like jquery
does load, but you are missing other files so your site breaks?  or do you
get no HTML to the browesr in either case?

as an aside - how is threadsafe working for you on GAE?  i had some
problems with it myselfperhaps i have bad code. :)

thanks,

cfh

On Thursday, August 16, 2012 1:29:00 PM UTC-7, Akash Kakkar wrote:


Hi,

I have tried deploying an earlier version of my app on gae and was
successful, unfortunately the product release version of my app is
faltering when I try to run locally on gae before deploying and was getting
undefined error. In the process of debugging I made changes in my app.yaml
file which is as below (deleted the skip files portion). I noticed that
with this when I try to run the application I get the following error:
 [Errno 13] file not accessible:
'/home/akash/webdev/web2py/applications/docmatorx/static/js/jquery.js'

  According to me the problem is with web2py_ajax.html file. which if I
leave blank the application runs (though the layout.html functionality and
the topbar vanishes)

//original web2py_ajax.html

 var w2p_ajax_confirm_message = "{{=T('Are you sure you want to
delete this object?')}}";
 var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}";
 var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}";
 
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}}



#*app.yaml*
#  For Google App Engine deployment, copy this file to app.yaml
#  and edit as required
#  See http://code.google.com/appengine/docs/python/config/appconfig.html
#  and http://web2py.com/book/default/chapter/11?search=app.yaml


application: 
version: 1
api_version: 1


# use this line for Python 2.5
#
# runtime: python


# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's
root directory)
#
runtime: python27
threadsafe: yes# true for WSGI & concurrent requests (Python 2.7
only)


default_expiration: "24h"   # for static files


handlers:


- url: /(?P.+?)/static/(?P.+)
   static_files: applications/\1/static/\2
   upload: applications/(.+?)/static/(.+)
   secure: optional


- url: /favicon.ico
   static_files: applications/welcome/static/favicon.ico
   upload: applications/welcome/static/favicon.ico


- url: /robots.txt
   static_files: applications/welcome/static/robots.txt
   upload: applications/welcome/static/robots.txt


- url: .*
# script: gaehandler.py # CGI
   script: gaehandler.wsgiapp# WSGI (Python 2.7 only)
   secure: optional


admin_console:
   pages:
   - name: Appstats
 url: /_ah/stats




builtins:
- default: on
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on
- django_wsgi: on


It would be nice If someone can tell me what is going wrong or if I can
get information on what files are included in the following statements
response.include_meta()
response.include_files()

My application runs (with limited layout features probably because of not
including the meta and add on files) if I edit the web2py_ajax.html file to
:











Thank You for your Help.









--





Re: [web2py] Re: Web2py GAE strange error [Errno 13] file not accessible: (jQuery.js)

2012-08-18 Thread Christian Foster Howes

i agree that it is GAE specific.  i've never had a problem elsewhere.

On 8/17/12 22:19 , Massimo Di Pierro wrote:

I opened an issue on googlecode. If there is a problem with thread safety
it is GAE specific. There is some logic created in the early days to cache
things on GAE assuming one process per request.

On Friday, 17 August 2012 23:11:34 UTC-5, howesc wrote:


db, auth, response was getting overwritten mid-request.  see
https://groups.google.com/forum/?fromgroups#!topic/web2py/aaG7YK7fddg[1-25]

On 8/17/12 19:49 , Massimo Di Pierro wrote:

What kind of thread problems did you have on GAE?

On Friday, 17 August 2012 16:23:17 UTC-5, howesc wrote:


response.include_file() outputs the files that were added to
response.files (js, css).  when you remove that you loose the auto

output

of files that were added to response.files along the way.

response.include_mete() works much the same for HTML meta properties.

can we see the resulting HTML in both cases?  in the first case (when

it

fails completely) you get HTML right?  but jquery.js fails to load so

other

things on your site might break.  in the second case it sounds like

jquery

does load, but you are missing other files so your site breaks?  or do

you

get no HTML to the browesr in either case?

as an aside - how is threadsafe working for you on GAE?  i had some
problems with it myselfperhaps i have bad code. :)

thanks,

cfh

On Thursday, August 16, 2012 1:29:00 PM UTC-7, Akash Kakkar wrote:


Hi,

I have tried deploying an earlier version of my app on gae and was
successful, unfortunately the product release version of my app is
faltering when I try to run locally on gae before deploying and was

getting

undefined error. In the process of debugging I made changes in my

app.yaml

file which is as below (deleted the skip files portion). I noticed

that

with this when I try to run the application I get the following error:
 [Errno 13] file not accessible:
'/home/akash/webdev/web2py/applications/docmatorx/static/js/jquery.js'

   According to me the problem is with web2py_ajax.html file. which if

I

leave blank the application runs (though the layout.html functionality

and

the topbar vanishes)

//original web2py_ajax.html

  var w2p_ajax_confirm_message = "{{=T('Are you sure you want to
delete this object?')}}";
  var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}";
  var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}";
  
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}}



#*app.yaml*
#  For Google App Engine deployment, copy this file to app.yaml
#  and edit as required
#  See

http://code.google.com/appengine/docs/python/config/appconfig.html

#  and http://web2py.com/book/default/chapter/11?search=app.yaml


application: 
version: 1
api_version: 1


# use this line for Python 2.5
#
# runtime: python


# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's
root directory)
#
runtime: python27
threadsafe: yes# true for WSGI & concurrent requests (Python 2.7
only)


default_expiration: "24h"   # for static files


handlers:


- url: /(?P.+?)/static/(?P.+)
static_files: applications/\1/static/\2
upload: applications/(.+?)/static/(.+)
secure: optional


- url: /favicon.ico
static_files: applications/welcome/static/favicon.ico
upload: applications/welcome/static/favicon.ico


- url: /robots.txt
static_files: applications/welcome/static/robots.txt
upload: applications/welcome/static/robots.txt


- url: .*
# script: gaehandler.py # CGI
script: gaehandler.wsgiapp# WSGI (Python 2.7 only)
secure: optional


admin_console:
pages:
- name: Appstats
  url: /_ah/stats




builtins:
- default: on
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on
- django_wsgi: on


It would be nice If someone can tell me what is going wrong or if I

can

get information on what files are included in the following statements
response.include_meta()
response.include_files()

My application runs (with limited layout features probably because of

not

including the meta and add on files) if I edit the web2py_ajax.html

file to

:











Thank You for your Help.














--





Re: [web2py] Re: Router for multiple controllers

2012-08-21 Thread Christian Foster Howes

that's what i get for typing so quickly!  thanks for spotting my mistake. :)

On 8/21/12 12:15 , Derek wrote:

wrong.
routes_in = ( ('/hello',  '/app1/controller1/hello'), ('/bye',
'/app1/controller*2*/bye'))

On Tuesday, August 21, 2012 9:42:27 AM UTC-7, howesc wrote:



routes_in = ( ('/hello',  '/app1/controller1/hello'), ('/bye',
'/app1/controller1/bye'))



On Tuesday, August 21, 2012 1:28:49 AM UTC-7, Daniel Gonzalez wrote:


Hello,

I have the following routing requirements, which I am unable to configure
in routes.py:

www.mysite.com/hello -> application1, controller1, hello
www.mysite.com/bye   -> application1, controller2, bye

As you can see, the functions hello and bye are in different controllers.
Is it possible to achieve this with routes.py?

Thanks,
Daniel







--





Re: [web2py] Re: Router for multiple controllers

2012-08-21 Thread Christian Foster Howes

i *think* it is one or the other, but not both. :(

there may be a routers equivalent to my suggestion, but i don't know it. 
:(  i know that you can convert routers into the routes_in/routes_out style.


On 8/21/12 12:41 , Daniel Gonzalez wrote:

Thanks howesc and Derek,

Your solution is working, but it is conflicting with routers. This is my
full routes.py:

routers = dict(
 BASE = dict(
 default_application = 'app1',
 ),
 myapp = dict(
 default_controller = 'controller1',
 default_function   = 'start',
 ),
)

routes_in = (
 ('/hello',   '/app1/controller1/hello'),
 ('/bye', '/app1/controller2/bye'),
)

I need both the shortcuts /hello and /bye, and the routers configuration.
Is this possible?

BR,
Daniel

On Tuesday, August 21, 2012 9:17:06 PM UTC+2, howesc wrote:


that's what i get for typing so quickly!  thanks for spotting my mistake.
:)

On 8/21/12 12:15 , Derek wrote:

wrong.
routes_in = ( ('/hello',  '/app1/controller1/hello'), ('/bye',
'/app1/controller*2*/bye'))

On Tuesday, August 21, 2012 9:42:27 AM UTC-7, howesc wrote:



routes_in = ( ('/hello',  '/app1/controller1/hello'), ('/bye',
'/app1/controller1/bye'))



On Tuesday, August 21, 2012 1:28:49 AM UTC-7, Daniel Gonzalez wrote:


Hello,

I have the following routing requirements, which I am unable to

configure

in routes.py:

www.mysite.com/hello -> application1, controller1, hello
www.mysite.com/bye   -> application1, controller2, bye

As you can see, the functions hello and bye are in different

controllers.

Is it possible to achieve this with routes.py?

Thanks,
Daniel












--





Re: [web2py] Re: Scaling Web2py

2012-09-03 Thread Christian Foster Howes
about the iOS api - we have RESTful requests that are responded to in 
json and we have a couple of views rendered as HTML.  much more JSON though.


GAE just turns on more instances as there are more requests.  they will 
happily run up your bill up to the maximum daily limit that you set.  i 
have never had a problem with spikes.


i run the GAE dev server locally, and yes i have multiple GAE 
applications - one for production and at least one for test (i have 
several clients that i work with running web2py on GAE, with some 
different test setups).


Johnathan is correct you can use non-default versions for testing - so 
long as that does not create data corruption since it uses the same 
database.  i use separated applications for testing because i'm, more 
often then i like to, changing schema in incompatible ways.


starmakerstudios.com (and the app) is the big projectwith indexes 
GAE tells me i'm over 300GB of data.  for me it's "fast enough" for the 
iOS developers it's never "fast enough". ;)  my average response to an 
iOS API call is under 500ms for about 95% of the calls.  the others have 
more complex data query/update requirements so they are understandably 
slower.


hope that helps.

cfh

On 9/3/12 7:42 , David Marko wrote:

Great!! The first set of questions ... some are maybe too private, you see
...

API for iOS
### does it mean that you dont use views, just endering data to JSON, and
data representation is done in iOS app?

30-40 request per second average sustained 24 hours a day.
### have you tried how high (in meaning of req/sec) you can get on GAE? Do
you have some peaks that are still served well?

we use google app engine.
### how do you evaluate entire dev process using web2py? Do you have some
procedure for deployment like develop localy using sqlite, then deploying
to some GAE demo account, then to production ??
### whats your long time experience with GAE in meaning of stability, speed
etc. ?
### how much data do you store in GAE datastore, is it fast enough?


Thanks!


Dne pondělí, 3. září 2012 15:07:09 UTC+2 howesc napsal(a):


yes, i manage a (seemingly to me) large application.  30-40 request per
second average sustained 24 hours a day.  that app is the data access API
for an iOS app plus an accompanying website.  some thoughts:
  - we use google app engine.  on the up side it serves all my requests, on
the downside we pay money in hosting to make up for bad programming.
  - we are using a class based models approach.   i'm interested in trying
the new lazy tables feature and perhaps switching to that.
  - we use memcache when possible. (it is possible to use it more we need
to work on that)
  - we are starting to use the google edge cache for pages/API responses
that are not user specific.  we can use more of this, but i believe those
requests served by the cache are counted in our request numbers.
  - some % of our API requests return somewhat static JSON - in this case
we generate the JSON when it changes (a few times a week), upload to amazon
S3, and then wrote a piece of router middleware to redirect the request
before web2py even is invokedso we have some "creative" things in there
to have high request numbers that are not quite hitting web2py itself.

i'm happy to talk more about specific experiences if there are more
specific questions.

On Saturday, September 1, 2012 11:58:46 AM UTC-7, David Marko wrote:


Hi all, i'm also curious on this. Can howesc share his experience ... Or
others ?  We are planing project for estimated 1mil views per working hours
(in 12 hours in day). I know that there are many aspects but generaly would
be encouraging to hear real life data with architecture info. How many
server do you use, do you use some round robin proxy etc. 







--





Re: [web2py] Re: facebook comments

2012-09-25 Thread Christian Foster Howes
what does http://developers.facebook.com/tools/debug tell you when you 
put your page URL in it?  i use that to get feedback from 
facebooksounds like there is something odd going on.


cfh

On 9/25/12 8:40 , Jose wrote:

Hi

if the url is http://www.my-domain.com

the message is not shown, but if I add the name of the application, it
displays the warning

http://www.my-domain.com/app-name

José



--





Re: [web2py] Re: Options for making a chat application with web2py

2012-05-04 Thread Christian Foster Howes
yup, i'm using it with web2py.  i just RTFM (for once the google docs 
are decent) and their python examples work just fine in web2py.  the 
javascript worked as advertized.


the one thing i had to do was map the /_ah callbacks for 
connect/disconnect in app.yaml to go to web2py and in web2py routes.py 
to go to my controller for handling those callbacks.  (and of course 
web2py DAL models rather than the GAE models in the GAE docs).


good luck!

cfh

On 5/4/12 13:46 , mrtn wrote:


Thanks howesc!

This is something I am totally not aware of, and it looks promising! Are
you using it with web2py? If so, could you elaborate a bit more on how this
thing can be integrated with web2py? Many thanks!


On Friday, May 4, 2012 10:45:43 AM UTC-4, howesc wrote:


if you desire to run on google app engine you can use the channel API:
https://developers.google.com/appengine/docs/python/channel/overview.
heck you might be able to import the JS side of it into your views and use
it not on the app engine, though i have not tried it.

i am starting to use it (not for chat but for other real-time messaging)
and it seems to be working pretty well in test.

On Wednesday, May 2, 2012 3:48:41 PM UTC-7, mrtn wrote:



So I've done some research on developing a chat app with web2py. First, I
took a look of:
http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_messaging.py,
and then a related tutorial using it: http://vimeo.com/38972256 (not in
english, so I might have missed a thing or two). What I can conclude from
them is that we can make a chat application *using websockets*. However,
since websockets is not supported by all the browsers except for Chrome (at
least not by default for latest versions of other major browsers, and
certainly not by their older versions), this solution has limited practical
use.

Thanks to questions previously asked in the group, I found this:
http://greg.thehellings.com/2011/05/web2py-websockets-and-socket-io-part-iii-socket-io/,
which attempts to use Tornadio (https://github.com/MrJoes/tornadio) with
Socket.io to circumvent the problem above, so that if websockets is not
available some other fall-back option is used instead. However, this method
stops working for new versions (0.7+) of Socket.io, even with the newer
Tornadio2 (https://github.com/MrJoes/tornadio2). In fact, the author of
the original blog post above eventually decided to abandon Socket.io
approach altogether after an effort to make things work:
https://github.com/mrjoes/tornadio2/issues/17.

So, does this mean that we are running out options for implementing a
practical chat application (which is probably one of the most typical
example applications made with different web frameworks these days) using
web2py? Apart from these websockets and its remedy Socket.io, is there any
other protocol/library we can use with web2py to make this happens? Would
love to hear your suggestions!





Re: [web2py] Re: Reloading modules

2012-05-10 Thread Christian Foster Howes

yes, sorry, i meant in development time.

in one project i moved models to modules and shaved about 33% off of the 
GAE production request time.  another project is in test this week and i 
will hopefully have numbers soon.  note that when you don't need auth 
(not all of my requests use auth) not setting it up saves about 200ms on 
GAE.


cfh

On 5/10/12 9:21 , Alex BENFICA wrote:

Hi...

When you say "now that i'm doing more and more in modules it does slow
things down"... are you talking about development time, right? is not
about the performace of you web2py app... is that?

The performance increase when using modules instead put code on models
worth all this extra work?
Do you have any measure about this performance gain?


On Thu, May 10, 2012 at 1:17 PM, howesc  wrote:

i use the persistent local datastore on GAE SDK as well.  i have not tried
to turn on dynamic module re-loading on GAE, but i have a shell script that
starts/stops GAE and i just restart that.  it's not as fast as
auto-reloading but it has been ok for me (though now that i'm doing more and
more in modules it does slow things down)


On Wednesday, May 9, 2012 2:27:33 PM UTC-7, Alex Benfica wrote:


Oi Ricardo,

Thanks.

I add the option to use sql lite and databse keeps data when I restart
app engine SDK.
And about the module reloading... did you have any problems with it?

On Wed, May 9, 2012 at 5:54 PM, Ricardo Pedroso
wrote:

On Wed, May 9, 2012 at 8:35 PM, Alex Benfica
wrote:


I'm having a seriuos problem having to stop and start Google App Engine
SDK
when I want edit modules, otherwise, they are not reloaded.
The problem is that, doing this, I lose the entire database content on
GAE
SDK...


You can persist the data on GAE SDK


https://developers.google.com/appengine/docs/python/tools/devserver#Using_the_Datastore

Ricardo




--
--

Atenciosamente,
Alex BENFICA

--
"O que não se mede não se gerencia."






Re: [web2py] Re: Unit Testing

2012-05-14 Thread Christian Foster Howes
Attached (assuming google groups accepts it) is my unit testing 
controller that i run on GAE development SDK.


also note that my db connection is defined as:

db = DAL('google:datastore')  # connect to Google BigTable
if request.test_db or request.function == "_TEST":
db = DAL('google:datastore://app_test')# set to test namespace

that allows me to run tests in a clean namespace in the GAE DB.


On 5/13/12 23:40 , Kimmo wrote:

I'd be interested in seeing this controller. Especially the part about
running the unittests.



On Wednesday, 9 May 2012 00:19:07 UTC+3, howesc wrote:


while i would not call anything i have great tests or a wonderful example
of testing, i have used doctests in controllers successfully.  those are
nice as the web2py environment is auto-setup for you.

i'm working on using the unittest module to test my modules - those don't
always need all the web2py stuff setup.

i'm running mainly on GAE and have modified the magic tests links from the
admin interface that run doctests and unittests to launch them from a
controller on my GAE dev environment.  i think i have posted that
controller before, but lemme know if you are interested in my re-posting it.

On Tuesday, May 8, 2012 2:12:13 AM UTC-7, Kimmo wrote:


I'm also trying to get unit tests working on web2py by following the
slices, but so far I've not been able to make them run properly. I'd like
to see some clear examples and maybe some real projects with unit tests on
web2py, to see how it's done in practice.


On Sunday, 6 May 2012 20:40:10 UTC+3, Rod Watkins wrote:


Hi everyone,

I am fairly new to web2py and python programming, but have had some
rather wonderful success in the month or so I've been learning it.

I am now preparing to start a real project and want to have unit tests
as I go.  I've read a bit (will be doing more) about python unit testing
(doctests, unittest, nose, coverage, selenium), but I want to get some
expert advise before I fully dive in, if I may. So a few questions:

1. Do you use unit tests?
2. What tools do you use (doctests, unittest, nose, coverage, selenium,
mocker, or others)?
3. Do you use any of the test runners from the community? (
http://packages.python.org/web2py_utils/test_runner.html,http://www.web2pyslices.com/slices/take_slice/142,http://web2py.com/AlterEgo/default/show/260)
Which, if any, would you suggest using?

I'm mainly looking for some guidance about how to proceed, what to study
and the best manner you've found to do unit tests.  For example, it is
worth doing anything more than doctests in controllers? If so, what beyond
them should I learn to use, etc.

Thanks everyone.
Rod


"""
This controller has methods to run the doctests in web2py.  app.yaml should
be configured so that only google app engine administrators have access to
these methods
"""
import sys

def die(msg):
print >> sys.stderr, msg
sys.exit(1)

@auth.requires_membership('admin-general')
def controllers():
"""
a method to test doctests

>>> #no doctests since that will ruin the tests
>>> assert(True==True)
"""
from gluon.fileutils import listdir
from gluon.admin import apath
app = request.application

if len(request.args) > 0:
file = request.args[0]
else:
file = '.*\.py'

if request.vars.reset:
#set to test namespace
from google.appengine.api import namespace_manager
namespace_manager.set_namespace('app_test')

for table in db.tables:
db(db[table].id>0).delete()
create_test_data()


controllers = listdir(apath('%s/controllers/' % app, r=request), file + '$')

return dict(app=app, controllers=controllers)

@auth.requires_membership('admin-general')
def modules():
"""
Run doctests in web2py environment. runs the tests in the modules

>>> #no doctests since that will ruin the tests
>>> assert(True==True)
"""
from gluon.shell import parse_path_info, env
import glob
import types
import sys
import cStringIO
import doctest
import os

verbose=request.vars.verbose or False

testpath=request.application
import_models=True

#get a list of the modules to test
cdir = os.path.join('applications', testpath, 'modules')
if not os.path.isdir(cdir):
die("modules is not a directory")
files = glob.glob(os.path.join(cdir, '*.py'))

#save stdout so we can capture data and reset it.
stdout = sys.stdout
html = ''

for testfile in files:
html += 'Testing module "%s.py" ... done.\n' % testfile

globs = env(testpath, import_models)
ignores = globs.keys()
execfile(testfile, globs)

def doctest_object(name, obj, html, new_env):
"""doctest obj and enclosed methods and classes."""

if type(obj) in (types.FunctionType

Re: [web2py] Re: Error facebook login

2012-05-15 Thread Christian Foster Howes

i don't understand,

https://graph.facebook.com/oauth/authorize?redirect_uri=http%3A%2F%2Fjuegozona.com%2Fuser%2Flogin&response_type=code&client_id=225870074195502 



is not an option?  i think that is what facebook needs.

cfh

On 5/15/12 13:54 , www.diazluis.com wrote:

Thanks for responding

no, not possible.
would have to be able to specify a dns PTR type, and I have that option

CAS system not work for me, I retornava error "infinite redirect"

I had several customers excited about the idea of ​​being able to log into
facebook ... pity it does not work ..


El martes, 15 de mayo de 2012 12:50:42 UTC-4:30, howesc escribió:


what are you using the generate the return URL that you pass to facebook
when you make the login request?  it looks like that is the culprit - i
always use a hostname and not IP address for the return URL.

On Tuesday, May 15, 2012 7:17:02 AM UTC-7, :


I'll try to explain better:
I need my app to do login using facebook.

you can test in juegozona.com

juegozona.com is configured in the "panel WebFaction" to use the ip:
108.59.6.232
http://i.minus.com/iFYHPECFl6LpM.png


when the visitor tries to login, facebook return to the page from
which you made the request.

here I present the following error:
http://i.minus.com/iyuafE7P1RyB.png


in the browser address bar displays the following code:

https://graph.facebook.com/oauth/authorize?redirect_uri=http%3A%2F%2F200.8.87.32%2Fuser%2Flogin&response_type=code&client_id=225870074195502

in which one can extract the ip address of return is: 200.8.87.32


my config dns is:
http://i.minus.com/ibod18TSOmp3vE.png
http://i.minus.com/irFLEZdFvmfsS.png


the facebook settings are correct:
http://i.minus.com/iYiz3kKyMV1Ll.png


what is the problem?

Díaz Luis
Analista Programador Facultad de Odontología UC
http://www.about.me/diazluis
User Linux 532223





Re: [web2py] Re: GAE datastore: how to unindex a field?

2012-05-16 Thread Christian Foster Howes
actually the question at hand here i think is whether or not web2py can 
support indexed=False in the property constructor when defining GAE models:


https://developers.google.com/appengine/docs/python/datastore/propertyclass

class Property(verbose_name=None, name=None, default=None, 
required=False, validator=None, choices=None, indexed=True)


i was hoping there was a way to specify that in index.yaml so that we 
didn't have to do extra work in the web2py GAE dal.  i have not found 
that there is or is not a way to specify that in index.yaml.


cfh

On 5/16/12 8:39 , Wikus van de Merwe wrote:

This is really a GAE question, not related to web2py. By default the
indexes are set automatically when you run your app in dev environment
depending on what queries you use. But you can do it manually to by editing
the index.yaml (above the #AUTOGENERATED line). On the next deploy the
indexes will be updated.

To disable the autogenerated indexes and test your index definitions, you
can run your app locally with:
dev_appserver.py --require_indexes

Read this article for more details:
https://developers.google.com/appengine/articles/indexselection




Re: [web2py] Re: hot to Run Python 2.5 scripts from python (for automating PSSE)

2012-05-31 Thread Christian Foster Howes

i start we2py with:

python2.5 web2py.py -a 

note that i have python2.5 on my path.  i'm also running the source 
distribution.


is that what you needed to get the python version for web2py?

cfh

On 5/31/12 16:23 , Janath wrote:



Thank you for the reply.

I am on doing last method of your list.

“just need to run web2py using the version of python that the PSSE lib
requires (i use web2py on python2.5

This api needs it to be run in python 2.5 ( It doesn’t work for other
versions of python I have tested for 2.3) . If I can start web2py in python
2.5 which is already installed in my computer, then it will be fine (as I
use the same to run psse). Because I guess it checks the registry info for
the particular python version.

** **

Also do you think I can try making the python version to 2.5 in web2 py,
but I don’t know how to do it.



On Thursday, May 31, 2012 10:14:30 AM UTC-5, howesc wrote:


i don't know anything about the PSSE system, but i'm confused.  is there a
PSSE server that you communicate with over a socket to make the API calls?
the traditional API model is that there is a long running "server" process,
and the client (in this case the web2py server) connects to some socket and
invokes the API calls.  is this what you are doing?

or is what you are doing using a PSSE python lib to connect to some PSSE
server?  in this case you should be able to use the PSSE lib from within
web2py.  perhaps you just need to run web2py using the version of python
that the PSSE lib requires (i use web2py on python2.5 all the time for
google app engine apps that i have not yet upgraded to python2.7, it's
still supported!)

hope that helps some!

On Tuesday, May 29, 2012 9:41:57 PM UTC-7, Janath wrote:


trying to be more specific :)

I am trying to see if I can start a python 2.5 shell (from within web2py)
and execute some commands to receive the results back to web2py.

is there any way of doing that, or should I drop that idea. If it sounds
not possible at this time with web2py, or if it takes some extensive time
consuming programming I am happy to drop that idea to seek for some other
way of getting the work done.

please advice.


On Friday, May 25, 2012 10:35:11 PM UTC-5, Janath wrote:


I am afraid I was unable capture the stack.

any clue as to how I can run a python process and keep communicating
with it during execution of web2py forms. If so I can send and receive the
commands and data to webpy.

Thank you,
Janath



On Wednesday, May 23, 2012 4:13:23 PM UTC-5, Derek wrote:


Then it is an unhandled exception. Which one? Run it in debug mode and
see if you can get the stack trace.

On Wednesday, May 23, 2012 10:50:41 AM UTC-7, Janath wrote:


when following runs at the initialisation, even the web2py server goes
down. the line in the bold face, tries to initialise psse and make trouble.
for me it seems, that psse needs the exact version (which is 2.5) to run
the api commands.
(I am not sure whether it checks the registry entry for particular
python version)

def index():
 import os,sys
 #import psspath
 mymodule = local_import('pssepath')
 sys.path.append('C:\\Program Files (x86)\\PTI\PSSE32\\PSSBIN')
 import psspy
 import win32gui
 mymodule.add_pssepath()
 try:
 *ierr=psspy.psseinit(8)*
 if ierr:
 print "can not initiate psse! quits"
 #raise SystemExit(" can not load case")
 except SystemExit:
 pass



thank you,
Janath


On Wednesday, May 23, 2012 9:17:46 AM UTC-5, Massimo Di Pierro wrote:


Can you point us to some code?

On Tuesday, 22 May 2012 21:07:37 UTC-5, Janath wrote:


I have written python scripts to automate PSSE (Siemens power system
simulation tool) using the pythonAPI provided.

I can run them using the gui I have made for python 2.5.

Psse 32 needs the exact version of python (2.5) to run the API.

I am trying to convert my application to a web based application
using web2py. I am unable to use API statements from web2py.

I think, if I can run the python 2.5 and get the outputs to web2py,
I will be able to do that.

Can someone give me a hand to do that also, better workarounds
are welcome.

Thank you,





Re: [web2py] Re: Send push notifications to IOS devices?

2012-06-05 Thread Christian Foster Howes
as long as your list is small urban airship provides a decent service. 
we were spending too much on them so we wrote our own. :)


On 6/5/12 16:11 , Jonathan Lundell wrote:

On Jun 5, 2012, at 4:06 PM, howesc wrote:

i coworker wrote a stand-alone (not web2py) push server for a project - but 
that's cause we are running our web2py on GAE and you can't create persistent 
connects to the APNS.

i'm not sure how to keep the connection open between requests in a web2py 
instance.  i suspect you'd have to have a long running process that collects 
tasks from a queue to send notifications.  (though if you only send 1 push per 
hour it's probably ok to make a new connection each time).


It might be more convenient to use a third-party http-to-apns bridge.

http://urbanairship.com has a basic plan with quite a bit of free volume. There 
others, I believe.



good luck!

cfh

On Tuesday, June 5, 2012 7:01:00 AM UTC-7, bob wrote:

I can send an email from within web2py but am wondering if anyone has attempted 
to send an IOS notification and if so any pointers would be very helpful.

What the Apple Push Notification service is:

  
https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9







Re: [web2py] Re: How can I have static files outside of static directory?

2012-06-09 Thread Christian Foster Howes
ok, then can you use your webserver to handle the static file handling 
rather than web2py?  that sounds like your best bet given your restrictions.


cfh

On 6/9/12 15:20 , Carl wrote:

It'd be nice that it wouldn't matter but tech often like that. Web2py treats 
files differently based upon location (see e manual's section on Web2py's 
static directory).

GWT sees its root and all files "below" and nothing "above".

And if I stick a GWT HTML file outside of static then Web2py doesn't allow 
static access to it.




Re: [web2py] Re: GAE - Datastore and CloudSQL together

2013-03-04 Thread Christian Foster Howes
ahh, the connection stuff is in the book:

#store sessions in the DB
session.connect(request,response,db = db) 

http://web2py.com/books/default/chapter/29/13#Avoid-the-filesystem

On Monday, March 4, 2013 9:50:02 PM UTC-8, Philip Kilner wrote:
>
> Hi, 
>
> On 05/03/13 02:02, howesc wrote: 
> > at one point i was running both together.  i did something like: 
> > 
> > db =  
> > sqldb =  
> > 
>
> Got it - had tied that, but... 
>
> > and then connected tickets and such to db. 
> > 
>
> ...could not work out how to point these "system" tables at the 
> alternate DB, given that they are not explicitly defined in the model. 
>
>
> -- 
>
> Regards, 
>
> PhilK 
>
>
> 'a bell is a cup...until it is struck' 
>
>

-- 

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




[web2py] Re: GAE Hosting Issue

2013-03-04 Thread Christian Foster Howes
hrmmaybe it's time for GAE's next code update.  i frequently notice a 
degradation in performance just before they announce a new SDK version.

i'm not seeing anything out of the ordinary on my GAE apps right now, but i 
do agree that the GAE team is not as transparent as i would like.

i would suggest that you read the logs very carefully - there are lots of 
different deadlineexceeded exceptions (literally the same class names with 
different paths) and try adding extra logging to see where things are 
getting stuck.

i don't know if web2py does automatic migrations on cloudsql, and in 
production i always do my SQL by handbut i'm old school and pessimistic.

cfh

On Monday, March 4, 2013 10:00:02 PM UTC-8, Philip Kilner wrote:
>
> Hi, 
>
> On 05/03/13 02:05, howesc wrote: 
> > i'm no longer using cloudSQL as i don't need it anymorebut several 
> > months ago when i was using it i got weird and varied problems on GAE 
> > when i had exceeded my billing quota on could SQL.  have you checked 
> > that those SQL instances are running and billing up to date? 
> > 
>
> I do have billing enabled, but am currently on a (temporarily) free D0 
> instance. Interesting that the problem kicked in less than an hour after 
> the start of the month though... 
>
> Having said that, I'm able to access the db perfectly via dbVisualiser 
> to work with it directly. 
>
> The majority of the errors suggest it is running out of time or 
> resources before it ever makes a db connection. 
>
> However, tinkering with a 2nd (empty) db against the same app it did 
> briefly burst into life, which made me wonder whether a failed migration 
> earlier in the day was involved. I can't see it really, because it never 
> seems to get as far as a connection with the production db. 
>
> This is in part the reason for my other question about using the 
> datastore form web2py's "system" stuff - I found myself wondering how 
> e.g. "fake_migrate_all" could work if the pickles were in the affected db. 
>
> I have to say, Google seem to be in denial about some of the issues on 
> GAE - some people (mostly but not exclusively on Java) have recently 
> suffered non-trivia performance / latency / timeout issues, and the 
> silence from the App Engine team is deafening... 
>
>
> -- 
>
> Regards, 
>
> PhilK 
>
>
> e: ph...@xfr.co.uk  - m: 07775 796 747 
>
> 'work as if you lived in the early days of a better nation' 
> - alasdair gray 
>

-- 

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




[web2py] Re: GAE Hosting Issue

2013-03-05 Thread Christian Foster Howes
the ticket you linked to looks like it is not failing on the connection, 
but rather failing on a query.  these 2 line are of interest to me:

  File "/base/data/home/apps/s~gk-hercules/1.365624770532609305/gluon/dal.py", 
line 4115, in execute
return self.log_execute(command.decode('utf8'), *a, **b)
  File "/base/data/home/apps/s~gk-hercules/1.365624770532609305/gluon/dal.py", 
line 1703, in log_execute
ret = self.cursor.execute(*a, **b)

any chance you are able to open dal.py and put in some debug logging at those 
lines an run it again? I'm curious what query/command web2py is trying to run 
on the database.  that might open the door to the missing answer!

cfh



On Monday, March 4, 2013 11:07:13 PM UTC-8, Philip Kilner wrote:
>
> Hi Christian, 
>
> On 05/03/13 06:12, Christian Foster Howes wrote: 
> > hrmmaybe it's time for GAE's next code update.  i frequently notice 
> > a degradation in performance just before they announce a new SDK 
> version. 
> > 
>
> Interesting observation - will look out for that. 
>
> > i'm not seeing anything out of the ordinary on my GAE apps right now, 
> > but i do agree that the GAE team is not as transparent as i would like. 
> > 
> > i would suggest that you read the logs very carefully - there are lots 
> > of different deadlineexceeded exceptions (literally the same class names 
> > with different paths) and try adding extra logging to see where things 
> > are getting stuck. 
> > 
>
> Actually, I'm not getting past a db connection so there is nothing in my 
> application code to log, and the logged errors accessible in the console 
> are very, very varied [1]. 
>
> > i don't know if web2py does automatic migrations on cloudsql, and in 
> > production i always do my SQL by handbut i'm old school and 
> pessimistic. 
> > 
>
> It does - I did have a failed migration (how I wish their CloudSQL 
> offering was based on Postgres!), but the app was buzzing away happily 
> with the help of "fake_migrate_all" for a good while after that. 
>
> The migration issues is messier than I'd like it to be on the this 
> platform (CloudSQL being as fragile as MySQL in that regard, and the 
> problem being compounded for me by the lack of tickets and my 
> uncertainty as to the fix given that the pickles are in the problem db). 
>
> I think perhaps that I too need to take an "old school and pessimistic" 
> approach on this platform (and MySQL in general for that matter). 
>
> BTW, in case anyone wonders why I'm using "fake_migrate_all" rather than 
> a per-table approach, it's because the error I was responding to 
> refereed to my (unmodified) auth_user table - I've simply not been able 
> to get in to revert that since this happened. 
>
>
> [1] https://code.google.com/p/googleappengine/issues/detail?id=8918 
>
> -- 
>
> Regards, 
>
> PhilK 
>
>
> e: ph...@xfr.co.uk  - m: 07775 796 747 
>
> 'work as if you lived in the early days of a better nation' 
> - alasdair gray 
>

-- 

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




[web2py] Re: GAE Hosting Issue

2013-03-06 Thread Christian Foster Howes

Philip,

"I've discovered that if I create an empty database via a direct 
connection to CloudSQL and point the DAL at that"  that statement makes 
me think


web2py *never* sends a "create database" statement to the database (no 
matter what DB you are using).  it expects that the DB server is up and 
running at the configured address, and that the empty database/schema 
(depending on the DB engine the terms change) is already there with 
proper permissions for the user that web2py will try to login with. 
then web2py will issue "create table" statements as needed.  if the 
database/schema does not exist, there will be errors.


cfh

On 3/6/13 0:07 , Philip Kilner wrote:

Hi Christian,

On 06/03/13 07:42, Christian Foster Howes wrote:

the ticket you linked to looks like it is not failing on the connection,
but rather failing on a query.  these 2 line are of interest to me:

   File
"/base/data/home/apps/s~gk-hercules/1.365624770532609305/gluon/dal.py", line
4115, in execute
 return self.log_execute(command.decode('utf8'), *a, **b)
   File
"/base/data/home/apps/s~gk-hercules/1.365624770532609305/gluon/dal.py", line
1703, in log_execute
 ret = self.cursor.execute(*a, **b)



Well spotted - it's spitting out a very wide variety of errors, but I'm
increasingly leaning to thinking it relates to the failed migration.


any chance you are able to open dal.py and put in some debug logging
at those lines an run it again? I'm curious what query/command web2py
is trying to run on the database.  that might open the door to the
missing answer!



I'll do that - I've discovered that if I create an empty database via a
direct connection to CloudSQL and point the DAL at that, the application
is accessible.

Given GAE's recent issues around resources/latency, I'm beginning to
think that this is the real issue, and the other factors are simply
generating spurious errors before it can show me the "real" error.

I'm really anxious to get the migration pickles out of the db that they
are attempting to manage and into GAE's datastore.

I've had to move the app to conventional hosting, as this has been a
huge time-sink, so it will be a day or two before I get back to it.





--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: GAE DB vs NDB

2013-03-09 Thread Christian Foster Howes
i've not used NDB, but i use the GAE datastore quite a lot.

lucky for me the projects i'm working on are OK with paying to use GAE so 
quota per-se is not a concernbut overall cost is.

some things that i have done:
 - i moved sessions to the DB, counter-intuitive i know, but they kept 
getting evicted from memcache and since google refuses to publish the 
memcache limitations i don't trust it for session data (at least not when 
i'm handling a sustained 30 request per second average 24 hours a day)
 - for "lookup" tables, or tables whose data changes very infrequently i 
have written module methods that read data from the cache if it exists, 
else read data the DB, convert it to a dict (Rows objects are not 
serializable and therefore not cacheable on GAE memcache) and store it in 
memcache.
 - i also make use of google edge cache by setting cache headers on 
responses that are static for some period of time.

NDB may be interestingbut i've been too lazy to read up on it. :(

cfh

On Tuesday, March 5, 2013 4:49:32 PM UTC-8, Aleš Holubec wrote:
>
> I read about many limitations if I will use GAE for web2py, nevertheless 
> it will not stop me :-)
> I think that main issue is to properly use memcaches. Is it enought to use 
> only cache.memcache and if yes what is the best way to use it? I plan to 
> use it for sessions a for selected results stored as dict, because I don't 
> want drain free quota on GAE to early. 
> But is it enough? Current DAL layer for GAE (google:datastore) is based on 
> db.Model but I think that some cache issues could be better solved if we 
> will use ndb.Model. I tried to modify dal.py to support it like google:ndb, 
> but I'm new in Python and I'm little bit shy to publish it because 
> modification is not so purely written and fully tested :-) 
> Do you have experience with that also?
>

-- 

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




[web2py] Re: Is it possible to deploy using Tornado on GAE?

2013-03-09 Thread Christian Foster Howes
greetings,

i don't know much about asynchronous i/o in web servers.

GAE provides its own web server.  there is no file writing in GAE (unless 
you use the blobstore), and most google API calls that you make can be made 
asynchronously with the proper settings.

overall i am very satisfied with GAE for hosting.  they have blips in the 
road...but who doesn't?

i have successfully written pages that load up slower the molasses on a 
cold day in janurary.and also written pages that load up lightning 
quick.  once you get the feel for the datastore, memcache and edge caching 
you can get things working very well together.

cfh

On Saturday, March 9, 2013 6:59:56 AM UTC-8, curiouslearn wrote:
>
> Hello,
>
> I have a couple of questions: is it possible to do asynchronous i/o using 
> web2py (would I need to use the Tornado server )? If so, is there a simple 
> example of this somewhere?
>
> Can such an app (that uses Tornado) be deployed on GAE or other SAAS 
> systems such as Dotcloud, Openshift etc.?
>
> Also, anyone who has an experience with GAE, what do you think of their 
> hosting quality. Do pages load up fast?
>
> Thanks for your help. Would really appreciate your comments?
>
>
>
>

-- 

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




[web2py] Re: web2py under GAE: disabling indexes

2013-03-09 Thread Christian Foster Howes
Massimo, Scott,

i filed https://code.google.com/p/web2py/issues/detail?id=1373 with a patch 
against trunk.  Looks like my first patch on this thread made it to the 
latest release, but the second patch did not.  If that can be applied i 
think we'll be all set.

perhaps i now need to start submitting book patches to write up these 
features!

cfh

On Thursday, February 28, 2013 9:35:33 AM UTC-8, Scott Hunter wrote:
>
> Sorry, I thought I had -- it works like a champ.  Would be nice if there 
> were a way to mark the signature fields as unindexed w/o having to recreate 
> them (not as simple as cut and paste, as the table def uses a bunch of 
> local definitions, but not hard), but definitely workable.  And lowers the 
> index overhead a LOT; in my case, from 15K to <3K.
>
> - Scott
>
> On Thursday, February 28, 2013 11:12:52 AM UTC-5, howesc wrote:
>>
>> can you let me know if it works as desired now?  if so, i'll submit the 
>> patch to massimo for review and possible inclusion in the next release of 
>> web2py.
>>
>> thanks,
>>
>> cfh
>>
>> On Tuesday, February 26, 2013 6:31:52 PM UTC-8, Scott Hunter wrote:
>>>
>>> With the latest patch, I was able to disable indices on the string 
>>> fields I wanted to.  Unfortunately (for me), I've just about used up my 
>>> quota, so I'll have to wait until tomorrow to see how much doing so saves 
>>> me.
>>>
>>> Thanks,
>>> Scott
>>>
>>> On Tuesday, February 26, 2013 8:50:29 PM UTC-5, howesc wrote:

 here's an updated DAL patch to try.

 thanks for trudging through this with us!

 cfh

 On Tuesday, February 26, 2013 3:36:30 PM UTC-8, Scott Hunter wrote:
>
> I'm working from Version 2.3.2 (2012-12-17 15:03:30) stable
>
> Here's the table in question (I've commented-out the custom_qualifier 
> for the string fields):
>
> db.define_table('t_run',
> Field('f_trial', type='reference t_trial',
>   label=T('Trial')),
> Field('f_when', type='date',
>   label=T('When')),
> Field('f_dog', type='reference t_dog',
>   label=T('Dog')),
> Field('f_name', type='string',#custom_qualifier={'indexed':False},
>   label=T('Name')),
> Field('f_breed', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Breed')),
> Field('f_jump_height', type='integer',custom_qualifier={'indexed':
> False},
>   label=T('Jump Height')),
> Field('f_level', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Level')),
> Field('f_class', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Class')),
> Field('f_pref', type='boolean',custom_qualifier={'indexed':False},
>   label=T('Preferred')),
> Field('f_armband', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Armband')),
> Field('f_yards', type='integer',custom_qualifier={'indexed':False
> },
>   label=T('Yards')),
> Field('f_sct', type='integer',custom_qualifier={'indexed':False},
>   label=T('SCT')),
> Field('f_judge', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Judge')),
> Field('f_score', type='integer',custom_qualifier={'indexed':False
> },
>   label=T('Score')),
> Field('f_time', type='double',custom_qualifier={'indexed':False},
>   label=T('Time')),
> Field('f_faults', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Faults')),
> Field('f_handler', type='string',
> #custom_qualifier={'indexed':False},
>   label=T('Handler')),
> Field('f_order', type='integer',
>   label=T('Order')),
> auth.signature,
> format='%(f_key)s',
> migrate=settings.migrate)
>
>
> P.S. Turning off the indexes DOES make a difference; with the changes 
> above, instead of using up over 30% of my quota, I'm "only" using 23%.  
> If 
> I can get the strings unindexed, and take out the web2py-supplied fields 
> (created_by & _on, modified_by & _on, and maybe is_active), that should 
> get 
> it down to something manageable.  (Not clear on how to handle the 
> web2py-supplied fields, as I don't know what parameters were using in 
> making them, making it difficult to know just how to "supply my own 
> definitions".)
>
> On Tuesday, February 26, 2013 6:24:21 PM UTC-5, howesc wrote:
>>
>> your line numbers are off from mine so i'm having trouble making 
>> sense of this. :(
>>
>> can you send your model definition so i can see what you are working 
>> with?  i think then i can line it up with the dal version i have here 
>> (which was trunk from HG as of saturday AM PST)
>>
>> cfh
>>
>> On Tuesday, Feb

[web2py] Re: Is it possible to deploy using Tornado on GAE?

2013-03-11 Thread Christian Foster Howes
sorry, i meant to say that i have written code that performed poorly and 
therefore made pages slow to load.

yes, there is a startup hit if your request launches a new instance.  in 
most cases i have found this to be acceptable (certainly much better then 
booting a new linux VM when load goes high).


On Sunday, March 10, 2013 10:11:41 AM UTC-7, curiouslearn wrote:
>
> Christian, thanks for the feedback. 
>
> Is it possible that the times you experienced slow load up was because the 
> applications were put to sleep? I think unless you have reserved instances, 
> GAE does that to applications that have not been accessed recently. If not, 
> it is slightly disappointing that GAE will not be very reliable when it 
> comes to loading speed. 
> That is certainly very helpful to know, so thanks again.
>
>  
>
> On Saturday, March 9, 2013 9:41:18 PM UTC-5, Christian Foster Howes wrote:
>>
>> greetings,
>>
>> i don't know much about asynchronous i/o in web servers.
>>
>> GAE provides its own web server.  there is no file writing in GAE (unless 
>> you use the blobstore), and most google API calls that you make can be made 
>> asynchronously with the proper settings.
>>
>> overall i am very satisfied with GAE for hosting.  they have blips in the 
>> road...but who doesn't?
>>
>> i have successfully written pages that load up slower the molasses on a 
>> cold day in janurary.and also written pages that load up lightning 
>> quick.  once you get the feel for the datastore, memcache and edge caching 
>> you can get things working very well together.
>>
>> cfh
>>
>> On Saturday, March 9, 2013 6:59:56 AM UTC-8, curiouslearn wrote:
>>>
>>> Hello,
>>>
>>> I have a couple of questions: is it possible to do asynchronous i/o 
>>> using web2py (would I need to use the Tornado server )? If so, is there a 
>>> simple example of this somewhere?
>>>
>>> Can such an app (that uses Tornado) be deployed on GAE or other SAAS 
>>> systems such as Dotcloud, Openshift etc.?
>>>
>>> Also, anyone who has an experience with GAE, what do you think of their 
>>> hosting quality. Do pages load up fast?
>>>
>>> Thanks for your help. Would really appreciate your comments?
>>>
>>>
>>>
>>>

-- 

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




[web2py] Re: how to use web application to send serial commands?

2013-03-15 Thread Christian Foster Howes
i'm not familiar with netcat and minicom.are those python libraries? or 
are there python libraries that know how to speak those things?

assuming you can write python that sends commands to the device (which i 
bet you can do), then it shouldn't be hard to have a URL call a controller 
that creates the right hardware message and sends it along.

On Sunday, March 10, 2013 11:15:18 PM UTC-7, theoffi...@gmail.com wrote:
>
> Hello everyone! i am clueless on how to create a web app that allows me to 
> control a device through serial command? 
> Currently my Raspberry Pi acts as a web2py server and it can communicate 
> with the device using netcat and minicom. 
> Can someone give me an idea or example? :) thank you very much! :)

-- 

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




[web2py] Re: web2py on GAE: Connect to google:sql and google:datastore

2013-03-15 Thread Christian Foster Howes
note that unless the book calls out google:sql vs google:datastore it's 
referring to google:datastore.  SQL was added much later by google, but 
it's a mysql compatible database, and so should have most (perhaps all?) 
the mysql features.

On Tuesday, March 12, 2013 2:14:39 AM UTC-7, decu...@uemd.net wrote:
>
> Hi all
>
> According to the web2py book[1] accessible_query(...) is not working on 
> GAE.
> As there is now a google:sql and google:datastore storage available I 
> thought of using both: sql for the auth and datastore for the rest.
> The output of the accessible_query would be ideal to query the datastore.
>
> What do you think? Could this work? Will web2py auth support this?
>
> In models/db.py I would try something like this:
>
> sql = DAL('google:sql')
> datastore = DAL('google:datastore')
> from gluon.tools import Auth
> auth = Auth(sql)
>
> Cheers
> -Luca.
>
> [1] http://web2py.com/books/default/chapter/29/09
>

-- 

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




Re: [web2py] Re: Ticket Error: could not open port /dev/ttyAMA0:

2013-03-15 Thread Christian Foster Howes
the "user" for web2py depends on how you launch it...

if you call:

python web2py.py

then it runs as you

if you:

sudo su bob
python web2py.py

it runs a bob.

if you use apache or some other server i believe by default it runs as the 
user that is running apache.

On Thursday, March 14, 2013 8:41:25 PM UTC-7, The Organisation of Secret 
Shoppers wrote:
>
> hmm how do i check? i think running the python script has to be "root" 
> user? but i'm not sure what is the user type for the web2py... 
>
>
> On Thu, Mar 14, 2013 at 4:24 PM, Niphlod  >wrote:
>
>> did you check that the user running your "working" script is the same as 
>> the one running the "I'm going wrong" web2py ?
>>
>>
>> On Thursday, March 14, 2013 8:30:38 AM UTC+1, theoffi...@gmail.com wrote:
>>>
>>> Hello guys, 
>>>
>>>
>>> i hope someone can help me with this! i have been stuck here for days. I 
>>> just created a web app using web2py and i want to use it to send some 
>>> serial commands to a device through Raspberry Pi. 
>>>
>>> I have successfully sent the commands from R-Pi to the device by running 
>>> a Python script in the terminal. 
>>>
>>> But i thought web2py is using python as well so i did something similar 
>>> but i get the error below:
>>> * could not open port 
>>> /dev/ttyAMA0: [Errno 13] Permission denied: '/dev/ttyAMA0'*
>>>
>>>
>>> my codes are:
>>>
>>> in Controller:
>>>
>>>
>>> def test():
>>>
>>> import serial
>>>
>>> serialport= serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5)
>>>
>>> return dict() <-- not sure what to return
>>> in view/default/index.html:
>>>
>>> https://10.0.0.132/examples/global/vars/URL>(c='default', 
>>> f='test')}}">>> height="75"
>>>
>>>
>>> i created a default/test.html as well. 
>>>
>>>
>>> i have no idea what's wrong! :( give me some hints please. thank you!
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/tiWZkXMoo6E/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

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




[web2py] Re: Uploading and Downloading Bulk data GAE

2013-03-15 Thread Christian Foster Howes
i use the bulk uploader/downloader from google (with some custom transforms 
to keep the same IDs across copies).  i've found it to be the most 
efficient and reliable way to get large amounts of data transferred.

On Thursday, March 14, 2013 5:00:20 AM UTC-7, José Manuel López wrote:
>
> Hi, 
> I'm searching for a method to upload / download data from / to GAE. 
> Basically I have Hotels, Hotels Images, Cities, Cities Images ... in wich 
> some images belongs to some Cities / Hotels. 
> I've found a way using the bulk uploader from Google, but I don't know if 
> it's the best way to do it because. 
>
> Any ideas?
>
> Thanks, 
> Jose M.
>

-- 

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




[web2py] Re: update existing project model without breaking backward compatibility...

2013-03-25 Thread Christian Foster Howes
perhaps i'm a bit old-fashioned, but i don't allow automatic SQL migrations 
on production.  what i tend to do:
 - use automatic migrations in develop
 - record the SQL executed.
 - create a script that combines the migration SQL web2py generates with my 
data migration.
 - put production into maintenance mode
 - run SQL migration script
 - update source code
 - turn production back on

so in your case my SQL migration script would:
 - create the new table
 - copy phone numbers into the new table from the existing table
 - drop the phone number column from the existing table.

that's my perspective on the problem, good luck!

christian

On Sunday, March 24, 2013 4:29:19 AM UTC-7, Loïc wrote:
>
> Hello all,
>
> let's imagine I have an app with the following model : 
>
> db.define_table('contact',
> Field('name'),
> Field('phone_number')
> )
>
> I have already deployed my app, and I have several contacts with a name 
> and a phone number.
>
> Then I realise that a contact can have multiple phone numbers. So I add a 
> table :
>
> db.define_table('phone number',
> Field('type'), #mobile phone number, home phone number, business 
> phone number ,...
> Field('phone_number'),
> Field('contact', 'reference contact'),
> )
>
> The first time I launch my app with the new model, I want to move existing 
> phone numbers from *contact *table to *phone_number *table.
> Then I want to remove 'phone_number' field from contact table to avoid 
> using it in the future
>
> What is the best way to do this automatically, and without breaking 
> backward compatibility?
>
> Thank you
>

-- 

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




[web2py] Re: does Field attribiute unique=True work on GAE?

2013-03-26 Thread Christian Foster Howes
i do make use of the IS_NOT_IN_DB() validator.  Note that you can still 
have duplicates if 2 requests are received by GAE at nearly the same time.

assuming your requests are more than say 1 second apart, if IS_NOT_IN_DB() 
is failing i would consider it a bug.

NOTE that GAE dev_appserver.py released late last week in the SDK update 
changes the consistency model making it much more likely that you will have 
"slow replication" on the dev server.

On Monday, March 25, 2013 6:18:37 PM UTC-7, Jaime Sempere wrote:
>
> Sorry to bump this up, but I have not been able of using unique as it is 
> described here (no validators).
>
> Also I have tried to use IS_NOT_IN_DB instead of unique as in this other 
> thread is suggested: 
> https://groups.google.com/forum/?fromgroups=#!searchin/web2py/gae$20unique/web2py/ZepLjcBowZs/FuKiSYZGzUAJ
>  ; 
> but same results
>
> Introducir código aquí...db.define_table('likes',
>   Field('user_id', 'reference users', 
> notnull='True'),
>   Field('post_id', 'reference posts', 
> notnull='True'),
>   Field('unique_key', unique=True, compute= lambda 
> row: "%(user_id)s-%(post_id)s" %row)
> )
>
>
> This worked for me in web2py but not in GAE (by the way I don't know if I 
> should add ,'string', after 'unique_key'. Anyway I have tried to add it 
> with same luck).
>
> I could check manually if 'unique_key' is already in DB before inserting 
> as Massimo suggested in the other thread, but I prefer not adding more code 
> (I have several unique fields that I would like to fix with a simple 
> solution). What am I doing wrong? 
>
> Thanks in advance
>
>
> El viernes, 24 de septiembre de 2010 06:50:01 UTC+2, mdipierro escribió:
>>
>> yes and no. It will not be enforced at the database level but if you 
>> do not specify validators, it will use it to pick default validator 
>> that enforce the uniqueness at the web2py level 
>>
>> On Sep 23, 11:17 am, Carl  wrote: 
>> > My db.py includes... 
>> > 
>> > db.define_table('voucher', 
>> > Field('code', 'string', length=128, unique=True, notnull=True, 
>> > required=True), 
>> >  
>> > 
>> > Locally on sqlite when I insert a second record with the same 'code' 
>> > as an existing record insert() throws an except. I catch the exception 
>> > and report back to the user. 
>> > 
>> > Locally on dev_appserver the "duplicate" insert() successfully inserts 
>> > a duplicate record; no exception is thrown. 
>> > 
>> > I've looked at the 2nd edition book and this group but can't find 
>> > anything that say that GAE doesn't support unqiue=True. 
>> > 
>> > Can anyone clarify this use of unique=True on GAE? 
>> > And if it's not supported is there a recommended alternative approach?
>
>

-- 

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




[web2py] Re: need teaching advice (JS+jQuery)

2013-04-06 Thread Christian Foster Howes
i was shown a demo recently of a project that pulled a bunch of data from a 
server into local storage (using HTML 5 local storage stuffs in modern 
browsers) and then doing some pretty nifty visualization in the browser.  
is use of local storage too server like for this class?

On Wednesday, April 3, 2013 10:47:15 AM UTC-7, Massimo Di Pierro wrote:
>
> Tomorrow I am starting teach a new class. I did not create the class, it 
> was assigned to me. The class is for undergraduate students who have little 
> or no programming experience but know HTML+CSS. No server-side programming 
> experience. The class should cover JS+jQuery but no server-side programming.
>
> What are some cool uses of JS/jQuery that do not involve server-side 
> programming? 
> I am thinking of hooking to some JSONP services. Is there any you would 
> suggest?
>
> Massimo
>

-- 

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




[web2py] Re: auth.user.id in restful api

2013-04-06 Thread Christian Foster Howes
have you tried decorating your GET/PUT/POST/DELETE methods with the 
@requires_login()?

@request.restful()
def user():
@requires_login()
def GET(*args, **kwargs):
 

i'm doing something similar to that...but with a custom decorator rather 
than requires_login.

cfh


On Friday, April 5, 2013 2:58:17 PM UTC-7, Philipp Müller wrote:
>
> Hello,
>
> I have written a restful API in web2py using @request_restful() and then 
> specified the patterns and tables that I wanted to expose in the API.
> The whole API uses basic auth, which is fine. I'm used to retrieving the 
> user, that currently uses a service by calling auth.user.id. If I wanted 
> to check what items in the database are associated with the currently 
> logged in user, I could do that with a db query. 
>
> Using @request_restful, I would like to do the exact thing, i.e. return 
> only values, that are associated with the user, that is currently using my 
> API. I have been able to figure out how to do this, any help regarding this 
> problem would be highly appreciated.
>
> Kind regards,
> Philipp
>

-- 

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




[web2py] Re: Building Query object based on Rows avoiding 'belongs'

2013-04-07 Thread Christian Foster Howes
speaking without reading the docs.so i might be misguided.

assuming that you can setup a grid with a rows object, you can use that 
patch.  just & the rows together and magic will happen.

the key no matter what is to setup multiple queries on GAE and & the 
results together, or re-imagine the dataset so there is less than 30 items 
in the belongs (which is sometimes impossible).

good luck!

cfh

On Sunday, April 7, 2013 2:13:35 PM UTC-7, Marcin Jaworski wrote:
>
> Hi web2py users!
>
> My environment: GAE SDK 1.7.5, web2py version 2.0.9.
>
> I need a query object as an argument for grid.
> I've got a database rows (ids) as the potential base for query 
> (list_of_ids) - unfortunately there are more than 30 of them so the 
> construct with 'belongs' does not work on GAE:
>
> query = db.field.id.belongs(list_of_ids)   # does not work on GAE
>
> There is a great solution to overcome the limit of 'belongs' on GAE:
> https://code.google.com/p/web2py/issues/detail?id=160
> but it let me identify just rows, when the query object for grid is needed 
> in my case.
>
> Can you advise?
> Marcin Jaworski
>
>
>
>

-- 

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




[web2py] Re: auth.user.id in restful api

2013-04-07 Thread Christian Foster Howes
Philipp,

i understand you nowunfortunately i have not used db.parse_as_rest so i 
don't know the answer... best i have is 
http://web2py.com/books/default/chapter/29/10?search=restful#parse_as_rest-%28experimental%29
  
perhaps someone can chime in with more details.

good luck!

cfh

On Sunday, April 7, 2013 6:28:10 AM UTC-7, Philipp Müller wrote:
>
> Hello,
>
> yes, all the methods are decorated with @requires_login(). The login 
> itself is not the problem, that works fine.
> The issue is, that I want to return user-specific results in my api. 
> Exposing one table by writing something along the lines of:
>
> @request.restful()
> @auth.requires_login()
> def v1():
> response.view = 'api.json'# +request.extension
> def GET(*args, **vars):
> 
> patterns = [
> "/stores[store]" ]
>
> parser = db.parse_as_rest(patterns, args, vars)
> if parser.status == 200:
> return dict(content=parser.response)
> else:
> raise HTTP(parser.status, parser.error)
>
> works fine.
>
> When I write "normal" database queries, that I want to return (logged in) 
> user-specific data, I can do it like this, i.e. to return the pets of a 
> user:
>
> def petsForOwnerQuery():
> pets = (db.pets.owner == db.owner.auth)
> return selectedStores
>
> then i can go on and retrieve the currently logged in owner like this:
>
> def ownerFromAuthUserQuery():
> loggedInOwner = (db.owner.auth == auth.user.id)
> return loggedInCustomer
>
> Combining these queries, I can retrieve the pets for the currently logged 
> in user.
>
> My question now is, how I can accomplish this, using the 
> @require_restful() decorator in my API.
>
> Thank you & regards,
> Philipp
>
>
> Am Samstag, 6. April 2013 19:40:39 UTC+2 schrieb Christian Foster Howes:
>>
>> have you tried decorating your GET/PUT/POST/DELETE methods with the 
>> @requires_login()?
>>
>> @request.restful()
>> def user():
>> @requires_login()
>> def GET(*args, **kwargs):
>>  
>>
>> i'm doing something similar to that...but with a custom decorator rather 
>> than requires_login.
>>
>> cfh
>>
>>
>> On Friday, April 5, 2013 2:58:17 PM UTC-7, Philipp Müller wrote:
>>>
>>> Hello,
>>>
>>> I have written a restful API in web2py using @request_restful() and then 
>>> specified the patterns and tables that I wanted to expose in the API.
>>> The whole API uses basic auth, which is fine. I'm used to retrieving the 
>>> user, that currently uses a service by calling auth.user.id. If I 
>>> wanted to check what items in the database are associated with the 
>>> currently logged in user, I could do that with a db query. 
>>>
>>> Using @request_restful, I would like to do the exact thing, i.e. return 
>>> only values, that are associated with the user, that is currently using my 
>>> API. I have been able to figure out how to do this, any help regarding this 
>>> problem would be highly appreciated.
>>>
>>> Kind regards,
>>> Philipp
>>>
>>

-- 

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




[web2py] Re: Query for an entity in GAE using id

2013-04-09 Thread Christian Foster Howes
Jose,

in theory that should work.  what does your decrementNumRooms method look 
like?  How do you know that it is not the right entity key?

For what it is worth, i don't use the gae Key object in my code, i just 
pass the web2py id to run_in_transaction and query based on that.  I know 
that it is working because i see transaction collusion warnings in my logs 
from time to time.

christian

On Tuesday, April 9, 2013 1:44:39 AM UTC-7, José Manuel López wrote:
>
> Hi, 
> I'm trying to get a Offer entity in my DB (GAE) and I'm doing something 
> like this:
>
> offerKey = gae.Key.from_path('Offer', offer.id)  # offer is my the offer 
> using DAL.
>
> Now I have to make a decrementation inside a transaction GAE:
> if (not gae.run_in_transaction(decrementNumRooms, offerKey)):
>
>  return dict(meta=dict(message=T("This offer is SoldOut") , status=206
> ))
>
> But gae.Key is not returning the correct Entity Key... 
>
> How can I do that?.
>
>

-- 

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




[web2py] Re: iOS + web2py

2013-04-11 Thread Christian Foster Howes
The backend for starmakerstudios.com and the various applications 
distributed by StarMaker Interactive are primarily run by web2py on GAE.  
In addition to the things Jonathan lists in his message, i love the support 
of this community - finding bugs, submitting patches, and generally keeping 
me up and running much better than things we are paying for!

So we have iOS (and in the coming months Android) apps talking to our 
web2py/GAE backend:
 - getting data to run the client
 - post user-generated data back to the server
 - no stats, we are using other tools for that cause GAE + stats == fail!
 - drive the website

christian


On Wednesday, April 10, 2013 9:40:58 AM UTC-7, Jonathan Lundell wrote:
>
> I've been working on a news-video iPad app (awards and everything! 
> featured by Apple! brag!) that uses web2py for a back-end server, 
> maintaining a database of videos &c and serving them up to the app via 
> JSONRPC. web2py also implements our internal curation UI to the database. 
>
> web2py has been a great solution for us because it solves a bunch of 
> different problems. 
>
> 1. it automatically updates our video feeds from their native sources 
> 2. it acts as our analytics collection point and does some first-stage 
> analysis 
> 3. it serves the app with auth services, video meta-data, etc 
> 4. it hosts a dynamic page to share videos publicly on the web 
> 5. it implements our internal curation UI 
>
> ...all with a single framework, and surprisingly little code. web2py 
> rules. 
>
> I'd like to hear from other projects with a foot in both the iOS and 
> web2py camps, with a general interest in comparing notes, exchanging tips & 
> gossip, whatever. 
>
> (We're also building our development team. I'd appreciate referrals of 
> experienced developers with those skills, preferably but not absolutely 
> necessarily both, who might like to work on a project like that. Drop me a 
> note and I'll tell you more off-list. We're in Silicon Valley, but are open 
> to remote developers.)

-- 

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




Re: [web2py] Re: upgrading appengine has broken web2py

2013-04-12 Thread Christian Foster Howes
i'm not having any problems with GAE + web2py.though i'm not fully 
upgraded on my web2py versions...perhaps i should do a test upgrade and see 
if i hit the same issues.

On Friday, April 12, 2013 9:10:10 AM UTC-7, Carl wrote:
>
> Perhaps 2.5 isn't far away given 2.4.6 is out.
>
> I'll be happy to a version of web2py with it removed.
>
>
> On 12 April 2013 16:17, Massimo Di Pierro 
> > wrote:
>
>> I proposed in web2py 2.5 we remove the gql module.
>>
>>
>> On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote:
>>>
>>> Removing the line "from gluon.contrib.gql import *" removed the error 
>>> and allows my app to launch.
>>>
>>> I next run into this error:
>>>   File "F:\wp\TestEnvoy\web2py\gluon\**main.py", line 555, in wsgibase
>>> session._try_store_in_db(**request, response)
>>>   File "F:\wp\TestEnvoy\web2py\gluon\**globals.py", line 747, in 
>>> _try_store_in_db
>>> record_id = table.insert(**dd)
>>>   File "F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py", line 256, in 
>>> insert
>>> id = self._create_id()
>>>   File "F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py", line 291, in 
>>> _create_id
>>> id = self._tableobj.incr(shard_id)
>>> AttributeError: 'MemcacheClient' object has no attribute 'incr'
>>>
>>> One for me to investigate.
>>>
>>>
>>>
>>> On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote:

 has my db.py content fallen out of date?

 it includes:
 from gluon.sql import SQLCustomType

 if request.env.web2py_runtime_**gae: # if running on Google App Engine
 from gluon.contrib.gql import *
 db = DAL('gae')


 On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote:
>
> actually.. while getting an unknown ticket if I request the url a 
> second time I get this:
>
>   File "F:\wp\TestEnvoy\web2py\**applications\init\models\db.**py", 
> line 13, in 
> from gluon.contrib.gql import *
>   File "F:\wp\TestEnvoy\web2py\gluon\**custom_import.py", line 100, 
> in custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> ImportError: No module named gql
>
> That's fairly obvious because I've just delete gql.py! :)
>
>
> On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote:
>>
>> If I remove the file (and its .pyc) then I get a web2py "Ticket 
>> issued: unknown"
>>
>> I'll try upgrading again.
>>
>>
>>
>> On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote:
>>>
>>> What if you delete that file?
>>>
>>> On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote:

 With an update to appengine, all is still fine when running web2py 
 locally.
 but if I run dev_appserver then on start-up I get the following 
 kicked out at the console...

  File "F:\wp\TestEnvoy\web2py\gluon\**contrib\gql.py", line 5, in 
 
 from gluon.dal import DAL, Field, Table, Query, Set, 
 Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, 
 SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, 
 SQLALL, 
 SQLCustomType, gae
 ImportError: cannot import name *drivers*
 *
 *
 \contrib\gql.py exists for backward compatibility.

 This looks like I've tripped up somewhere really simple. Can anyone 
 point me in the right direction?

>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

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




Re: [web2py] Re: upgrading appengine has broken web2py

2013-04-13 Thread Christian Foster Howes

The 2 versions that i have used this week with the latest GAE are:

Version 2.0.8 (2012-09-07 03:47:51) stable
Version 2.0.9 (2012-09-13 23:51:30) stable

cfh

On 4/12/13 21:13 , Carl Roach wrote:

What version are you using Christian?
On 12 Apr 2013 23:34, "Christian Foster Howes"  wrote:


i'm not having any problems with GAE + web2py.though i'm not fully
upgraded on my web2py versions...perhaps i should do a test upgrade and see
if i hit the same issues.

On Friday, April 12, 2013 9:10:10 AM UTC-7, Carl wrote:


Perhaps 2.5 isn't far away given 2.4.6 is out.

I'll be happy to a version of web2py with it removed.


On 12 April 2013 16:17, Massimo Di Pierro  wrote:


I proposed in web2py 2.5 we remove the gql module.


On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote:


Removing the line "from gluon.contrib.gql import *" removed the error
and allows my app to launch.

I next run into this error:
   File "F:\wp\TestEnvoy\web2py\gluon\main.py", line 555, in
wsgibase
 session._try_store_in_db(**reque**st, response)
   File "F:\wp\TestEnvoy\web2py\gluon\globals.py", line 747, in
_try_store_in_db
 record_id = table.insert(**dd)
   File "F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py", line 256,
in insert
 id = self._create_id()
   File "F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py", line 291,
in _create_id
 id = self._tableobj.incr(shard_id)
AttributeError: 'MemcacheClient' object has no attribute 'incr'

One for me to investigate.



On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote:


has my db.py content fallen out of date?

it includes:
from gluon.sql import SQLCustomType

if request.env.web2py_runtime_**gae**: # if running on Google App
Engine
 from gluon.contrib.gql import *
 db = DAL('gae')


On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote:


actually.. while getting an unknown ticket if I request the url a
second time I get this:

   File "F:\wp\TestEnvoy\web2py\**applic**ations\init\models\db.**py",
line 13, in 
 from gluon.contrib.gql import *
   File "F:\wp\TestEnvoy\web2py\gluon\custom_import.py", line
100, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named gql

That's fairly obvious because I've just delete gql.py! :)


On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote:


If I remove the file (and its .pyc) then I get a web2py "Ticket
issued: unknown"

I'll try upgrading again.



On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote:


What if you delete that file?

On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote:


With an update to appengine, all is still fine when running web2py
locally.
but if I run dev_appserver then on start-up I get the following
kicked out at the console...

  File "F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py", line 5,
in 
 from gluon.dal import DAL, Field, Table, Query, Set,
Expression, Row, Rows, *drivers*, BaseAdapter, SQLField,
SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB,
SQLALL, SQLCustomType, gae
ImportError: cannot import name *drivers*
*
*
\contrib\gql.py exists for backward compatibility.

This looks like I've tripped up somewhere really simple. Can
anyone point me in the right direction?


  --


---
You received this message because you are subscribed to a topic in the
Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/**
topic/web2py/0XH6l1394mA/**unsubscribe?hl=en<https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en>
.
To unsubscribe from this group and all its topics, send an email to
web2py+un...@**googlegroups.com.
For more options, visit 
https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
.





  --


---
You received this message because you are subscribed to a topic in the
Google Groups "web2py-users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.







--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: delete on GAE

2012-10-20 Thread Christian Foster Howes

sure.  i'll make a patch soon...

thanks for the input!

cfh

On 10/20/12 13:29 , Massimo Di Pierro wrote:

I meant to skip count.

On Saturday, 20 October 2012 15:28:56 UTC-5, Massimo Di Pierro wrote:


How about adding a gae only parameter to the gae adapter_args that tells
it to skip fetch?

On Saturday, 20 October 2012 11:25:51 UTC-5, howesc wrote:


It appears that the most efficient way to delete on app engine is to:
  - build a query object, like we are doing now
  - call run with keys_only=True (
https://developers.google.com/appengine/docs/python/datastore/queryclass#Query_run)
which returns an iterator.
  - pass that iterator to the datastore delete method (
https://developers.google.com/appengine/docs/python/datastore/functions#delete
)

this avoids the cost of loading the rows into memory, decreases the
likelihood of timeout, and has the cost of 1 datastore small operation per
row.  but it does prevent us from getting a count of rows deleted.

the way we do it now:
  - run count() on the query.  this has a cost (time and money) of
iterating over all the rows that match the query on GAE (1 datastore small
operation per row)
  - run fetch(limit=1000) and call delete() successively until no more
rows.  this has the cost of running a full query (at least 1 datastore read
operation per row) and loading the result set into memory and then deleting
the results.

in my case i'm timing out on the count() call so i don't even start the
delete.  from an efficiency standpoint i'd rather have more rows deleted
for less cost then get a countbut this may not be acceptable for all.
  at a minimum i think we should switch to use keys_only=True for the fetch,
and skip the leading count() call and just sum the number of times we call
fetch.  we may also consider catching the datastore timeout error and
trying to handle a partial delete more gracefully (or continue to let the
user catch the error).

what is the "right" approach for web2py?  if the approach with count is
correct, could i propose a gae bulk_delete method that does not return
count but uses my first method?

thanks for the input!

cfh

On Saturday, October 20, 2012 7:58:56 AM UTC-7, Massimo Di Pierro wrote:


Delete should return the number of deleted records. What is your
proposal?

On Wednesday, 17 October 2012 17:30:22 UTC-5, howesc wrote:


Hi all,

I'm trying to clean up old expired sessions.but i waited a long
time to get to this and now my GAE delete is just timing out.  Reading the
GAE docs, there appears to be some improvements that we can make to the
query delete method on GAE that will make it faster and cheaper.  what we
lose then is the count of the number of rows deleted.

my question is, does having a db(db.table.something==True).delete()
that does not return a count break the web2py API contract, or break
anyone's applications?

thanks,

christian







--





Re: [web2py] Re: Multi-language website with GAE + parameter-based system

2012-11-15 Thread Christian Foster Howes

it's in app.yaml, so it's GAE specific.

On 11/15/12 17:45 , Massimo Di Pierro wrote:

Where is this regex?

On Thursday, 15 November 2012 13:10:50 UTC-6, David Sorrentino wrote:


Hi howesc,

Testing the regex I found out the error.
Intead of:

url: /(?P.+?)/static/\w\{2}?/(?P.+)


it should be:

url: /(?P.+?)/static/\w{2}?/(?P.+)




So a backslash was making the difference! :P

Thank you very much for your help, now everything works.

Cheers,
David


On 15 November 2012 02:42, howesc > wrote:


the error is not obvious to me. :(  can you verify that your regex
matches your URL?


On Tuesday, November 13, 2012 6:01:09 AM UTC-8, David Sorrentino wrote:


Hi howesc,

Thanks for your reply!

I tried to set the regex for my needs, but I guess that I am wrong in
something.
I edited the regex in this way:


- url: /(?P.+?)/static/\w\{2}?/(?**P.+)
   static_files: applications/\1/static/\2
   upload: applications/(.+?)/static/(.+)
   secure: optional



Now, instead of an error, I get 2 warnings for each static file:

WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595]

Blocking access to static file "/home/dapids/web2py/**
applications/myapp/static/en/**css/bootstrap-responsive.min.**css"



WARNING  2012-11-13 13:54:19,604 dev_appserver_import_hook.py:**595]

Blocking access to static file "/home/dapids/web2py/**
applications/myapp/static/css/**bootstrap-responsive.min.css"



Any thoughts?

Cheers,
David


On 12 November 2012 23:03, howesc  wrote:


i don't know the full deal with the routerbut it looks like the
path to the static files is incorrect (notice the 'en' in the path).  you
can strip this out in app.yaml (my example strips out a random cache
busting param after the 'static/' in the path, you can modify the regex to
meet your needs):

- url: /(?P.+?)/static/.*?/(?P.**+)
   static_files: applications/\1/static/\2
   upload: applications/(.+?)/static/(.+)
   secure: optional
   expiration: "1d"

cfh


On Monday, November 12, 2012 7:19:32 AM UTC-8, David Sorrentino wrote:


Hello everybody! :)

I am developing a multi-language website deployed on GAE.
For my routes.py I would like to use this configuration, shown on the
online book (http://web2py.com/books/**defau**lt/chapter/29/04#**
Parameter-**based-system
):

routers = dict(
   BASE  = dict(default_application='**myap**p'),
   myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),
)

However, it looks like I am having some troubles with loading the
static files. Indeed static files are not loaded and the console shows the
following error:
[Errno 2] No such file or directory: '/home/dapids/web2py/**applicati*
*ons/myapp/en/static/**css/**bootstrap-responsive.min.**css'

Am I doing something wrong?

Cheers,
David


  --






  --












--





Re: [web2py] Re: Unable to send email in web2py

2012-11-21 Thread Christian Foster Howes

i have used 587 successfully in the past.

i noticed that username if not a gmail account is the full email address 
like:


  b...@foo.com:password

perhaps try that even with the gmail account?

cfh

On 11/21/12 16:43 , Daniele Pestilli wrote:

I tried with port *465* and *587* any other port suggestions?


On Thu, Nov 22, 2012 at 12:35 AM, howesc  wrote:


login to gmail and check out that google is not requiring a verification
(i find that for my unused email aliases that i send from that every few
months google wants me to login for real to keep the account active).

also double check the google docs, i think there is a couple of smtp ports
they use and sometimes switching to the other port makes a difference.

On Wednesday, November 21, 2012 11:32:26 AM UTC-8, Daniele wrote:


I'm trying to send emails upon user registration. This is what I have in
my models file:

mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'em...@gmail.com' #There's a proper email here
mail.settings.login = 'username:password' #There's a proper
username/password combination here
auth.settings.registration_**requires_verification = True
auth.messages.verify_email = 'Click on the link http://' +
request.env.http_host + URL(r=request,f='user',args=['**verify_email'])
+ '/%(key)s to verify your email'

mail.settings.server = settings.email_server
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login

But every time I register a user with a valid email address, I'm getting
no email.
So I'm trying to do it manually with:

mail.send('em...@gmail.com', 'Message subject', 'Plain text body of the 
message')


But I'm getting an error message in the terminal that says:
WARNING:web2py:Mail.send failure:[Errno 111] Connection refused

How can I fix this???


  --








--





Re: [web2py] Re: web2py 2.3.2 added "+ -" to some form elements

2012-12-20 Thread Christian Foster Howes
ok, here is a patch against current *trunk*.  this should never allow 
you to remove the last item from the list.  note that when the list is 
empty (showing one field with no data) the + and - buttons appear to be 
no-op.


On 12/20/12 7:06 , Massimo Di Pierro wrote:

For now I have remove the "-" button.

On Wednesday, 19 December 2012 23:48:37 UTC-6, howesc wrote:


ooops.  i added the - and didn't test the "only 1 row case".  i'll try and
create a patch tomorrow for it.

mind opening a ticket in google code?

thanks,

christian

On Tuesday, December 18, 2012 8:17:11 AM UTC-8, Daniele wrote:


The newest version of web2py has added some + and - clickable links to
form elements so that it is possible to remove the element. However, if
there is only one element and one clicks the "-", the form disappears and
there's no way to get the form element back without refreshing the page.

I'll post an image so that you can see what it looks like.

I think this is a bug with the newest version because my code hasn't
changed at all. There was only a "+" before...







--



diff -r 4c55a243c4c2 gluon/sqlhtml.py
--- a/gluon/sqlhtml.py  Thu Dec 20 09:22:24 2012 -0600
+++ b/gluon/sqlhtml.py  Thu Dec 20 10:45:52 2012 -0800
@@ -263,18 +263,27 @@
 jQuery.fn.grow_input = function() {
   return this.each(function() {
 var ul = this;
-jQuery(ul).find(":text").after('+').keypress(function (e) { return (e.which == 
13) ? pe(ul) : true; }).next().click(function(){ pe(ul) });
+jQuery(ul).find(":text").after('+ -').keypress(function (e) { return (e.which == 
13) ? pe(ul, e) : true; }).next().click(function(e){ pe(ul, e) 
}).next().click(function(e){ rl(ul, e)});
   });
 };
 function pe(ul, e) {
   var new_line = ml(ul);
   rel(ul);
-  new_line.appendTo(ul);
+  if ($(e.target).parent().is(':visible')) {
+//make sure we didn't delete the element before we insert after
+new_line.insertAfter($(e.target).parent());
+  } else {
+//the line we clicked on was deleted, just add to end of list
+new_line.appendTo(ul);
+  }
   new_line.find(":text").focus();
   return false;
 }
 function rl(ul, e) {
-  jQuery(e.target).parent().remove();
+  if (jQuery(ul).children().length > 1) {
+//only remove if we have more than 1 item so the list is never empty
+$(e.target).parent().remove();
+  }
 }
 function ml(ul) {
   var line = jQuery(ul).find("li:first").clone(true);


Re: [web2py] Re: web2py 2.3.2 added "+ -" to some form elements

2012-12-20 Thread Christian Foster Howes
and here is the diff between the 2.3.2 release and the patch i made in 
case you want to apply it to gluon/sqlhtml.py in your environment.


sorry for the headache!

cfh

On 12/20/12 7:06 , Massimo Di Pierro wrote:

For now I have remove the "-" button.

On Wednesday, 19 December 2012 23:48:37 UTC-6, howesc wrote:


ooops.  i added the - and didn't test the "only 1 row case".  i'll try and
create a patch tomorrow for it.

mind opening a ticket in google code?

thanks,

christian

On Tuesday, December 18, 2012 8:17:11 AM UTC-8, Daniele wrote:


The newest version of web2py has added some + and - clickable links to
form elements so that it is possible to remove the element. However, if
there is only one element and one clicks the "-", the form disappears and
there's no way to get the form element back without refreshing the page.

I'll post an image so that you can see what it looks like.

I think this is a bug with the newest version because my code hasn't
changed at all. There was only a "+" before...







--



272c272,278
<   new_line.insertAfter(jQuery(e.target).parent());
---
>   if ($(e.target).parent().is(':visible')) {
> //make sure we didn't delete the element before we insert after
> new_line.insertAfter($(e.target).parent());
>   } else {
> //the line we clicked on was deleted, just add to end of list
> new_line.appendTo(ul);
>   }
277c283,286
<   jQuery(e.target).parent().remove();
---
>   if (jQuery(ul).children().length > 1) {
> //only remove if we have more than 1 item so the list is never empty
> $(e.target).parent().remove();
>   }


Re: [web2py] Re: web2py 2.3.2 added "+ -" to some form elements

2012-12-20 Thread Christian Foster Howes

(my first try didn't post)

ok, here is a patch against current *trunk*.  this should never allow
you to remove the last item from the list.  note that when the list is
empty (showing one field with no data) the + and - buttons appear to be
no-op.

--



diff -r 4c55a243c4c2 gluon/sqlhtml.py
--- a/gluon/sqlhtml.py  Thu Dec 20 09:22:24 2012 -0600
+++ b/gluon/sqlhtml.py  Thu Dec 20 10:45:52 2012 -0800
@@ -263,18 +263,27 @@
 jQuery.fn.grow_input = function() {
   return this.each(function() {
 var ul = this;
-jQuery(ul).find(":text").after('+').keypress(function (e) { return (e.which == 
13) ? pe(ul) : true; }).next().click(function(){ pe(ul) });
+jQuery(ul).find(":text").after('+ -').keypress(function (e) { return (e.which == 
13) ? pe(ul, e) : true; }).next().click(function(e){ pe(ul, e) 
}).next().click(function(e){ rl(ul, e)});
   });
 };
 function pe(ul, e) {
   var new_line = ml(ul);
   rel(ul);
-  new_line.appendTo(ul);
+  if ($(e.target).parent().is(':visible')) {
+//make sure we didn't delete the element before we insert after
+new_line.insertAfter($(e.target).parent());
+  } else {
+//the line we clicked on was deleted, just add to end of list
+new_line.appendTo(ul);
+  }
   new_line.find(":text").focus();
   return false;
 }
 function rl(ul, e) {
-  jQuery(e.target).parent().remove();
+  if (jQuery(ul).children().length > 1) {
+//only remove if we have more than 1 item so the list is never empty
+$(e.target).parent().remove();
+  }
 }
 function ml(ul) {
   var line = jQuery(ul).find("li:first").clone(true);



Re: [web2py] Re: Implementing task queue using web2py

2012-02-14 Thread Christian Foster Howes
what is the error in the logs when the task fails?  what is the URL 
shown in the task list?  something is either amok with the URL itself, 
or something is causing that function to fail when called via the task 
queue.


On 2/13/12 20:05 , Saurabh S wrote:

It worked when I passed a different controller in the url other than
the one it is being called from.

It is production.
I checked the task queue it simply retries continuously if the same
controller is provided.
No params is not a mandatory argument to takqueue.add() I guess.
Because it does not throw any syntax error if not provided.

On Feb 10, 8:52 pm, howesc  wrote:

some questions/thoughts:

  - local test server or production?
  - did you check the task queue?  in production go to the admin console and
find the task queues link.  in local test go to /_ah/admin and find the
task queue link
  - is params a required argument to taskqueue.add()?  i don't know if i
always use it cause i need it or cause it is required.







Re: [web2py] Re: Anyone using Backbone.js?

2012-02-16 Thread Christian Foster Howes

i did this to use static files to contain my handlebars code:

$.get("{{=URL(r=request, c='static', 
f='js/handlebars/views/popup.html')}}", function(data) {

popup_template = Handlebars.compile(data);
});


On 2/15/12 23:33 , David Marko wrote:

I'm also making decision right now and evaluating emberjs and backbone. The
emberjs is much clear form me but there is a problem with their template
engine  http://handlebarsjs.com/ which colide with web2py templates marks
{{ }}
HandleBars templates are placed in  tags so it would be great if I
can say somehow that web2py should skip parsing its content as web2py
template.

(also the ember data is claimed as not production ready, and thats
important for serious project)

Something like this: see 'data-web2py-skip='true''