[web2py] Re: GAE 1.8.1 and logging doesn't work

2013-06-20 Thread Christian Foster Howes
i have not updated my local launcher to 1.8.1 yethopefully tomorrow.  
but in past versions of GAE i have changed line 74 of gaehandler.py (at the 
web2py top-level) to:

#logging.basicConfig(level=logging.INFO)
#access the GAE logging handler and set level to ignore debug logs
logging.getLogger().handlers[0].setLevel(logging.INFO)

that seemed to help me weed out some extra logs (i never had luck with 
logging.conf and GAE).  can you try and see if that helps?  if so let's 
submit an patch to massimo!

thanks,

christian

On Wednesday, June 19, 2013 8:26:54 AM UTC-7, José Manuel López wrote:


 Hi!,
 I've change to GAE 1.8.1 and suddenly (before, with GAE 1.7.5 everything 
 worked ok) the LOG is not working. None of my debugs lines are dump to 
 console. Then I've see that my logging.conf was not being used. This is my 
 log config:

 [loggers]
 keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome, myApp

 [logger_myApp]
 level=DEBUG
 qualname=web2py.app.myApp
 handlers=consoleHandler
 propagate=0
 and in my controller:
 import logging
 logger = logging.getLogger(request.application)
 logger.setLevel(logging.DEBUG)

 Anyone knows why this is happening  or any clue at least?
 Any help will be very appreciated. 
 Thank you in advance


-- 

--- 
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: computed fields ... order of calculation?

2013-06-20 Thread Tim Richardson
It seems in Table._listify(...) that the row object passed to the compute 
function only includes non-compute fields, so attempting to refer to a 
computed field fails (silently). 

-- 

--- 
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: upgrade to 2.4.6 breaks existing code. function replace in psycopg2

2013-06-20 Thread Peter
I have a encountered a problem with an update from v1.97 to 
v2.4.6-stable+timestamp.2013.04.06.17.37.38. Only found out I had these 
problems after pushing to production server which uses Python 2.6, while my 
local test set ups all use Python 2.7. In both cases SQLite DBs are used.

Queries fail whenever web2py's contains() is used:

web2py query:
qiosqNr = 'blaat'
db(db.node.qiosqNumber.contains(qiosqNr)).select()

Web2py Error:

OperationalError: no such function: REPLACE


SQLquery:
SELECT  node.id, node.qiosqNumber, node.mac1, node.mac2, node.is_active, 
node.created_on, node.created_by, node.modified_on, node.modified_by FROM 
node WHERE (node.qiosqNumber LIKE (('%' || (REPLACE('blaat','%','%%')) || 
'%')));

Compaired to web2py's like() instead of contains() - manual states 
.like('%blaat%') it is equal to .contains('blaat'):

web2py query:
qiosqNr = 'blaat'
db(db.node.qiosqNumber.like('%'+qiosqNr+'%')).select()

SQLquery:
SELECT  node.id, node.qiosqNumber, node.mac1, node.mac2, node.is_active, 
node.created_on, node.created_by, node.modified_on, node.modified_by FROM 
node WHERE (node.qiosqNumber LIKE '%blaat%');

SQLquery shows the difference, even if results are the same. Yet where 
contains() throws an error on the production server, like() doesn't.


gluon/dal.py (v2.4.6):
def CONTAINS(self, first, second, case_sensitive=False):
# silently ignore, only case sensitive
# There is a technical difference, but mongodb doesn't support
# that, but the result will be the same
return {self.expand(first) : ('/%s/' % \
self.expand(second, 'string'))}

gluon/dal.py (v1.9.7):
def CONTAINS(self, first, second):
if first.type in ('string', 'text'):
key = '%'+str(second).replace('%','%%')+'%'
elif first.type.startswith('list:'):
key = '%|'+str(second).replace('|','||').replace('%','%%')+'|%'
return '(%s LIKE %s)' % (self.expand(first),self.
expand(key,'string'))

gluon/dal.py (trunk):
def CONTAINS(self,first,second,case_sensitive=False):
if first.type in ('string','text', 'json'):
second = Expression(None,self.CONCAT('%',Expression(
None,self.REPLACE(second,('%','%%'))),'%'))
elif first.type.startswith('list:'):
second = 
Expression(None,self.CONCAT('%|',Expression(None,self.REPLACE(

Expression(None,self.REPLACE(second,('%','%%'))),('|','||'))),'|%'))
op = case_sensitive and self.LIKE or self.ILIKE
return op(first,second)

What would be the best option for me to fix this problem asap? Should I 
roll CONTAINS() in gluon/dal.py back to v1.97 spec? Or perhaps get it from 
trunk?

-- 

--- 
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] Login form - How can I disable or easily avoid url hex encoding in login_next?

2013-06-20 Thread Georgess
Hi all,
For example original url is  /init/service/index?service_code=sf_vod
but for login form it became as  _next = 
/init/service/index%3Fservice_code%3Dsf_vod

'?' and '=' are replaced in URL and after that the modified doesn't work -  
invalid request

-- 

--- 
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: computed fields ... order of calculation?

2013-06-20 Thread Massimo Di Pierro
Try and let us know. :-)


On Thursday, 20 June 2013 01:31:22 UTC-5, Tim Richardson wrote:

 It seems in Table._listify(...) that the row object passed to the compute 
 function only includes non-compute fields, so attempting to refer to a 
 computed field fails (silently). That's because the fields variable only 
 includes fields updated by the form (I think). 
 If I was to append to fields any compute fields discovered as we build the 
 to_compute list, would the sky fall in? 
 I'm going to try 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 1.8.1 and logging doesn't work

2013-06-20 Thread José Manuel López
Thank you Christian!, 
Now, I have a lot of LOGs :) (more logs is far better that no logs! :)). 
Like you, I had no luck with logging.conf.
Working now, thank you again. 

On Thursday, June 20, 2013 8:09:10 AM UTC+2, Christian Foster Howes wrote:

 i have not updated my local launcher to 1.8.1 yethopefully tomorrow.  
 but in past versions of GAE i have changed line 74 of gaehandler.py (at the 
 web2py top-level) to:

 #logging.basicConfig(level=logging.INFO)
 #access the GAE logging handler and set level to ignore debug logs
 logging.getLogger().handlers[0].setLevel(logging.INFO)

 that seemed to help me weed out some extra logs (i never had luck with 
 logging.conf and GAE).  can you try and see if that helps?  if so let's 
 submit an patch to massimo!

 thanks,

 christian

 On Wednesday, June 19, 2013 8:26:54 AM UTC-7, José Manuel López wrote:


 Hi!,
 I've change to GAE 1.8.1 and suddenly (before, with GAE 1.7.5 everything 
 worked ok) the LOG is not working. None of my debugs lines are dump to 
 console. Then I've see that my logging.conf was not being used. This is my 
 log config:

 [loggers]
 keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome, myApp

 [logger_myApp]
 level=DEBUG
 qualname=web2py.app.myApp
 handlers=consoleHandler
 propagate=0
 and in my controller:
 import logging
 logger = logging.getLogger(request.application)
 logger.setLevel(logging.DEBUG)

 Anyone knows why this is happening  or any clue at least?
 Any help will be very appreciated. 
 Thank you in advance



-- 

--- 
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: Scheduler compatible with nginx/uwsgi?

2013-06-20 Thread Joe Barnhart
I understand importing modules, or at least I thought I did...  Why would it 
affect scheduler.py if I Import datetime in a module of my own?  I haven't made 
mods to scheduler.py if that is what you meant. 

-- 

--- 
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: Free opensource Janrain alternative - Python Social auth

2013-06-20 Thread Quint
Hi,

Does anyone have an example on how to hook this up in web2py?

-- 

--- 
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: SQLFORM.factory and list:integer error

2013-06-20 Thread Martin Barnard
That code listing is from dal.py. I didn't really want to poke too much at 
that as I haven't had time to examine it too deeply. 

I should probably upgrade to latest web2py before trying anything else :)

*/scurries off to upgrade the server...*

On Thursday, June 20, 2013 12:45:28 AM UTC+3, Niphlod wrote:

 it's a bug reproduceable only if you leave one empty field.
 BTW, you're parsing it wrong given a single field filled with 1234, 
 you get [1,2,3,4] back.

 you should do

 vars = form.vars.employees
 if vars:
 if isinstance(vars, (list, tuple)):
 for a in vars:
 ids.append(a)
 else:
 ids.append(vars)

 Anyway, I'll submit an issue with the fix.


- 









-- 

--- 
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: Scheduler compatible with nginx/uwsgi?

2013-06-20 Thread Niphlod
I think because python doesn't know what to do on importing the same 
library name ... it probably just overwrites it discarding the old 
one the point is that the datetime is both the name of the root module 
and the child one.

same thing should happen on web2py applications too, I think it's a general 
python problem rather than something scheduler specific.

Il giorno giovedì 20 giugno 2013 13:09:21 UTC+2, Joe Barnhart ha scritto:

 I understand importing modules, or at least I thought I did...  Why would 
 it affect scheduler.py if I Import datetime in a module of my own?  I 
 haven't made mods to scheduler.py if that is what you meant. 

-- 

--- 
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] Unable to cache Row objects

2013-06-20 Thread Quint
Hi,

I am using GAE (dev server) and i am unable to cache Row objects.
For some reason they cannot be pickled.
When a convert it to dicts everything works fine, but then i am unable to 
work with web2py Rows.

This is a related post: 
https://groups.google.com/forum/#!msg/web2py/SbJGKMRyeT8/BNybB-znFQgJ

I tried 2 different ways and below i copied the errors. The first is when 
using my own caching mechanism in which i pickle the data myself and 
directly use GAE memcache.
The second is when i use @cache.action
*
*
*Pickle by me*
=

Traceback (most recent call last):

File C:\Users\\gluon\restricted.py, line 212, in 
restricted
exec ccode in environment
File C:\Users\\applications\init\controllers/api.py, line 
401, in module
File C:\Users\\gluon\globals.py, line 194, in lambda
self._caller = lambda f: f()
File C:\Users\\gluon\globals.py, line 158, in f
return rest_action(*_self.args, **_self.vars)
File C:\Users\\applications\init\controllers/api.py, line 
346, in GET
return get(get_articles, use_etag, t, categories=c, channel=ch)
File C:\Users\\applications\init\controllers/api.py, line 
259, in get
cached_response = pickle.dumps(cached_response)
File C:\Python\Python273_X86\Lib\pickle.py, line 1374, in dumps
Pickler(file, protocol).dump(obj)
File C:\Python\Python273_X86\Lib\pickle.py, line 224, in dump
self.save(obj)
File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
self.save_reduce(obj=obj, *rv)
File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
save(args)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
save(element)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
self._batch_setitems(obj.iteritems())
File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
save(v)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
self._batch_setitems(obj.iteritems())
File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
save(v)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 600, in save_list
self._batch_appends(iter(obj))
File C:\Python\Python273_X86\Lib\pickle.py, line 615, in _batch_appends
save(x)
File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
self.save_reduce(obj=obj, *rv)
File C:\Python\Python273_X86\Lib\pickle.py, line 419, in save_reduce
save(state)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
self._batch_setitems(obj.iteritems())
File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
save(v)
File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
self.save_reduce(obj=obj, *rv)
File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
save(args)
File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self
File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
save(element)
File C:\Python\Python273_X86\Lib\pickle.py, line 300, in save
self.save_global(obj)
File C:\Python\Python273_X86\Lib\pickle.py, line 748, in save_global
(obj, module, name))
PicklingError: Can't pickle class 'gluon.dal.article': it's not found as 
gluon.dal.article


*@cache.action*
===

Traceback (most recent call last):
File C:\Users\\gluon\restricted.py, line 212, in 
restricted
exec ccode in environment
File C:\Users\\applications\init\controllers/api.py, line 
403, in module
File C:\Users\\gluon\globals.py, line 194, in lambda
self._caller = lambda f: f()
File C:\Users\\gluon\cache.py, line 505, in wrapped_f
rtn = cache_model(cache_key, lambda : func(), time_expire=time_expire)
File C:\Users\\gluon\contrib\gae_memcache.py, line 40, in 
__call__
self.client.set(key, (time.time(), value))
File C:\Program Files 
(x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
line 773, in set
namespace=namespace)
File C:\Program Files 
(x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
line 878, in _set_with_policy
time, '', namespace)
File C:\Program Files 
(x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
line 957, in _set_multi_async_with_policy
stored_value, flags = _validate_encode_value(value, self._do_pickle)
File C:\Program Files 

[web2py] Re: upgrade to 2.4.6 breaks existing code. function replace in psycopg2

2013-06-20 Thread Peter
I rolled CONTAINS() in gluon/dal.py (line 1258) back to v1.97 spec which 
seems to solve the problem.

On Wednesday, June 19, 2013 7:24:40 PM UTC+2, Peter wrote:

 I have a encountered a problem with an update from v1.97 to 
 v2.4.6-stable+timestamp.2013.04.06.17.37.38. Only found out I had these 
 problems after pushing to production server which uses Python 2.6, while my 
 local test set ups all use Python 2.7. In both cases SQLite DBs are used.

 Queries fail whenever web2py's contains() is used:

 web2py query:
 qiosqNr = 'blaat'
 db(db.node.qiosqNumber.contains(qiosqNr)).select()

 Web2py Error:

 OperationalError: no such function: REPLACE


 SQLquery:
 SELECT  node.id, node.qiosqNumber, node.mac1, node.mac2, node.is_active, 
 node.created_on, node.created_by, node.modified_on, node.modified_by FROM 
 node WHERE (node.qiosqNumber LIKE (('%' || (REPLACE('blaat','%','%%')) || 
 '%')));

 Compaired to web2py's like() instead of contains() - manual states 
 .like('%blaat%') it is equal to .contains('blaat'):

 web2py query:
 qiosqNr = 'blaat'
 db(db.node.qiosqNumber.like('%'+qiosqNr+'%')).select()

 SQLquery:
 SELECT  node.id, node.qiosqNumber, node.mac1, node.mac2, node.is_active, 
 node.created_on, node.created_by, node.modified_on, node.modified_by FROM 
 node WHERE (node.qiosqNumber LIKE '%blaat%');

 SQLquery shows the difference, even if results are the same. Yet where 
 contains() throws an error on the production server, like() doesn't.


 gluon/dal.py (v2.4.6):
 def CONTAINS(self, first, second, case_sensitive=False):
 # silently ignore, only case sensitive
 # There is a technical difference, but mongodb doesn't support
 # that, but the result will be the same
 return {self.expand(first) : ('/%s/' % \
 self.expand(second, 'string'))}

 gluon/dal.py (v1.9.7):
 def CONTAINS(self, first, second):
 if first.type in ('string', 'text'):
 key = '%'+str(second).replace('%','%%')+'%'
 elif first.type.startswith('list:'):
 key = '%|'+str(second).replace('|','
 ||').replace('%','%%')+'|%'
 return '(%s LIKE %s)' % (self.expand(first),self.
 expand(key,'string'))

 gluon/dal.py (trunk):
 def CONTAINS(self,first,second,case_sensitive=False):
 if first.type in ('string','text', 'json'):
 second = Expression(None,self.CONCAT('%',Expression(
 None,self.REPLACE(second,('%','%%'))),'%'))
 elif first.type.startswith('list:'):
 second = 
 Expression(None,self.CONCAT('%|',Expression(None,self.REPLACE(
 
 Expression(None,self.REPLACE(second,('%','%%'))),('|','||'))),'|%'))
 op = case_sensitive and self.LIKE or self.ILIKE
 return op(first,second)

 What would be the best option for me to fix this problem asap? Should I 
 roll CONTAINS() in gluon/dal.py back to v1.97 spec? Or perhaps get it 
 from trunk?


-- 

--- 
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: Unable to cache Row objects

2013-06-20 Thread Anthony
See http://web2py.com/books/default/chapter/29/06#Caching-selects. Have you 
tried:

db(query).select(..., cacheable=True)

Anthony

On Thursday, June 20, 2013 10:02:44 AM UTC-4, Quint wrote:

 Hi,

 I am using GAE (dev server) and i am unable to cache Row objects.
 For some reason they cannot be pickled.
 When a convert it to dicts everything works fine, but then i am unable to 
 work with web2py Rows.

 This is a related post: 
 https://groups.google.com/forum/#!msg/web2py/SbJGKMRyeT8/BNybB-znFQgJ

 I tried 2 different ways and below i copied the errors. The first is when 
 using my own caching mechanism in which i pickle the data myself and 
 directly use GAE memcache.
 The second is when i use @cache.action
 *
 *
 *Pickle by me*
 =

 Traceback (most recent call last):

 File C:\Users\\gluon\restricted.py, line 212, in 
 restricted
 exec ccode in environment
 File C:\Users\\applications\init\controllers/api.py, 
 line 401, in module
 File C:\Users\\gluon\globals.py, line 194, in lambda
 self._caller = lambda f: f()
 File C:\Users\\gluon\globals.py, line 158, in f
 return rest_action(*_self.args, **_self.vars)
 File C:\Users\\applications\init\controllers/api.py, 
 line 346, in GET
 return get(get_articles, use_etag, t, categories=c, channel=ch)
 File C:\Users\\applications\init\controllers/api.py, 
 line 259, in get
 cached_response = pickle.dumps(cached_response)
 File C:\Python\Python273_X86\Lib\pickle.py, line 1374, in dumps
 Pickler(file, protocol).dump(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 224, in dump
 self.save(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
 save(args)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
 save(element)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 600, in save_list
 self._batch_appends(iter(obj))
 File C:\Python\Python273_X86\Lib\pickle.py, line 615, in _batch_appends
 save(x)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 419, in save_reduce
 save(state)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
 save(args)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
 save(element)
 File C:\Python\Python273_X86\Lib\pickle.py, line 300, in save
 self.save_global(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 748, in save_global
 (obj, module, name))
 PicklingError: Can't pickle class 'gluon.dal.article': it's not found as 
 gluon.dal.article


 *@cache.action*
 ===

 Traceback (most recent call last):
 File C:\Users\\gluon\restricted.py, line 212, in 
 restricted
 exec ccode in environment
 File C:\Users\\applications\init\controllers/api.py, 
 line 403, in module
 File C:\Users\\gluon\globals.py, line 194, in lambda
 self._caller = lambda f: f()
 File C:\Users\\gluon\cache.py, line 505, in wrapped_f
 rtn = cache_model(cache_key, lambda : func(), time_expire=time_expire)
 File C:\Users\\gluon\contrib\gae_memcache.py, line 40, 
 in __call__
 self.client.set(key, (time.time(), value))
 File C:\Program Files 
 (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
 line 773, in set
 namespace=namespace)
 File C:\Program Files 
 (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
 line 878, in 

[web2py] Re: SQLFORM.factory and list:integer error

2013-06-20 Thread Martin Barnard
Upgraded, but the error is still there. It's failing at the SQLFORM 
validation in dal.py, I don't even get the chance to access session 
variables myself. Also, list:integer fields leave an empty field behind

Is there a way from within the DAL to remove empty entries on list:integer 
(as I can't rely on my users to not create empty entries when using the 
form)?

def index():


form=SQLFORM.factory(
Field('employees', 'list:integer' ),
)
my_emps=[]
if form.process(session=None).accepted:
mvars=form.vars.employees
if mvars:
response.flash=myvars
for a in mvars:
my_emps.append(a)
else:
my_emps.append(mvars)

return dict(form=form, my_emps=my_emps)


Error:


Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted
exec ccode in environment
  File /home/www-data/web2py/applications/experiment/controllers/default.py, 
line 196, in module
  File /home/www-data/web2py/gluon/globals.py, line 194, in lambda
self._caller = lambda f: f()
  File /home/www-data/web2py/applications/experiment/controllers/default.py, 
line 127, in index
if form.process(session=None).accepted:
  File /home/www-data/web2py/gluon/html.py, line 2188, in process
self.validate(**kwargs)
  File /home/www-data/web2py/gluon/html.py, line 2127, in validate
if self.accepts(**kwargs):
  File /home/www-data/web2py/gluon/sqlhtml.py, line 1571, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/www-data/web2py/gluon/dal.py, line 8598, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File /home/www-data/web2py/gluon/dal.py, line 1203, in insert
query = self._insert(table,fields)
  File /home/www-data/web2py/gluon/dal.py, line 1194, in _insert
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /home/www-data/web2py/gluon/dal.py, line 1194, in genexpr
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /home/www-data/web2py/gluon/dal.py, line 1376, in expand
return str(self.represent(expression,field_type))
  File /home/www-data/web2py/gluon/dal.py, line 1805, in represent
obj = map(int,obj)
ValueError: invalid literal for int() with base 10: ''







On Thursday, June 20, 2013 2:31:51 PM UTC+3, Martin Barnard wrote:

 That code listing is from dal.py. I didn't really want to poke too much at 
 that as I haven't had time to examine it too deeply. 

 I should probably upgrade to latest web2py before trying anything else :)

 */scurries off to upgrade the server...*

 On Thursday, June 20, 2013 12:45:28 AM UTC+3, Niphlod wrote:

 it's a bug reproduceable only if you leave one empty field.
 BTW, you're parsing it wrong given a single field filled with 1234, 
 you get [1,2,3,4] back.

 you should do

 vars = form.vars.employees
 if vars:
 if isinstance(vars, (list, tuple)):
 for a in vars:
 ids.append(a)
 else:
 ids.append(vars)

 Anyway, I'll submit an issue with the fix.


- 









-- 

--- 
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: Unable to cache Row objects

2013-06-20 Thread Quint
thnx,


I added cacheable=True to the select() but still the same error.

On Thursday, June 20, 2013 4:23:02 PM UTC+2, Anthony wrote:

 See http://web2py.com/books/default/chapter/29/06#Caching-selects. Have 
 you tried:

 db(query).select(..., cacheable=True)

 Anthony

 On Thursday, June 20, 2013 10:02:44 AM UTC-4, Quint wrote:

 Hi,

 I am using GAE (dev server) and i am unable to cache Row objects.
 For some reason they cannot be pickled.
 When a convert it to dicts everything works fine, but then i am unable to 
 work with web2py Rows.

 This is a related post: 
 https://groups.google.com/forum/#!msg/web2py/SbJGKMRyeT8/BNybB-znFQgJ

 I tried 2 different ways and below i copied the errors. The first is when 
 using my own caching mechanism in which i pickle the data myself and 
 directly use GAE memcache.
 The second is when i use @cache.action
 *
 *
 *Pickle by me*
 =

 Traceback (most recent call last):

 File C:\Users\\gluon\restricted.py, line 212, in 
 restricted
 exec ccode in environment
 File C:\Users\\applications\init\controllers/api.py, 
 line 401, in module
 File C:\Users\\gluon\globals.py, line 194, in lambda
 self._caller = lambda f: f()
 File C:\Users\\gluon\globals.py, line 158, in f
 return rest_action(*_self.args, **_self.vars)
 File C:\Users\\applications\init\controllers/api.py, 
 line 346, in GET
 return get(get_articles, use_etag, t, categories=c, channel=ch)
 File C:\Users\\applications\init\controllers/api.py, 
 line 259, in get
 cached_response = pickle.dumps(cached_response)
 File C:\Python\Python273_X86\Lib\pickle.py, line 1374, in dumps
 Pickler(file, protocol).dump(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 224, in dump
 self.save(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
 save(args)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
 save(element)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 600, in save_list
 self._batch_appends(iter(obj))
 File C:\Python\Python273_X86\Lib\pickle.py, line 615, in _batch_appends
 save(x)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 419, in save_reduce
 save(state)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 649, in save_dict
 self._batch_setitems(obj.iteritems())
 File C:\Python\Python273_X86\Lib\pickle.py, line 663, in _batch_setitems
 save(v)
 File C:\Python\Python273_X86\Lib\pickle.py, line 331, in save
 self.save_reduce(obj=obj, *rv)
 File C:\Python\Python273_X86\Lib\pickle.py, line 401, in save_reduce
 save(args)
 File C:\Python\Python273_X86\Lib\pickle.py, line 286, in save
 f(self, obj) # Call unbound method with explicit self
 File C:\Python\Python273_X86\Lib\pickle.py, line 562, in save_tuple
 save(element)
 File C:\Python\Python273_X86\Lib\pickle.py, line 300, in save
 self.save_global(obj)
 File C:\Python\Python273_X86\Lib\pickle.py, line 748, in save_global
 (obj, module, name))
 PicklingError: Can't pickle class 'gluon.dal.article': it's not found 
 as gluon.dal.article


 *@cache.action*
 ===

 Traceback (most recent call last):
 File C:\Users\\gluon\restricted.py, line 212, in 
 restricted
 exec ccode in environment
 File C:\Users\\applications\init\controllers/api.py, 
 line 403, in module
 File C:\Users\\gluon\globals.py, line 194, in lambda
 self._caller = lambda f: f()
 File C:\Users\\gluon\cache.py, line 505, in wrapped_f
 rtn = cache_model(cache_key, lambda : func(), time_expire=time_expire)
 File C:\Users\\gluon\contrib\gae_memcache.py, line 40, 
 in __call__
 self.client.set(key, (time.time(), value))
 File C:\Program Files 
 (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py, 
 line 773, in 

[web2py] problem with GAE ReferenceProperty

2013-06-20 Thread Quint
Hi,

I have a problem when i perform a select() on a model with an 
ReferenceProperty Field.
I'am getting this error:

*('ReferenceProperty' object has no attribute 'startswith',)*
*
*
related but nor sure it's the same:
https://groups.google.com/forum/?fromgroups#!topic/web2py/M7civkMWRyo

and it occurs at this line in dal.py:

def represent(self, obj, fieldtype):
*field_is_type = fieldtype.startswith*
if isinstance(obj, CALLABLETYPES):
obj = obj()
if isinstance(fieldtype, SQLCustomType):
return fieldtype.encoder(obj)
if isinstance(obj, (Expression, Field)):
raise SyntaxError(non supported on GAE)
if self.dbengine == 'google:datastore':
if isinstance(fieldtype, gae.Property):
return obj


Now, at the time the exception occurs the Fieldtype is of type 
ReferenceProperty which does not have a startswith attribute.

When i move this line to another position, the error is gone.
But i'm not familiar enough with the code to be sure this i the correct 
solution.
Maybe the source of the problem lies somewhere else..

this works:

def represent(self, obj, fieldtype):

if isinstance(obj, CALLABLETYPES):
obj = obj()
if isinstance(fieldtype, SQLCustomType):
return fieldtype.encoder(obj)
if isinstance(obj, (Expression, Field)):
raise SyntaxError(non supported on GAE)
if self.dbengine == 'google:datastore':
if isinstance(fieldtype, gae.Property):
return obj

*field_is_type = fieldtype.startswith*

Any idea?

thanks!



-- 

--- 
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] web2pyslice and PIL thumbnail quality

2013-06-20 Thread lesssugar
A bit of offtopic but maybe someone knows what's going on. I'm using this 
thumbnail generating slice I found:

LINKhttp://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box

All works fine but the problem I face is the thumbnails quality. I upload 
really high-quality images and the generated thumbs are definitely not HQ.

I tried adding *quality=90 *argument to these lines of smarthumb.py:
*
*
img.thumbnail(box, Image.ANTIALIAS)

and

img.save(request.folder + 'uploads/' + thumb)

respectively:

img.save(request.folder + 'uploads/' + thumb, quality=90)
and 
img.save(request.folder + 'uploads/' + thumb, quality=90)

-- no effect. Any ideas?



-- 

--- 
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: Unable to cache Row objects

2013-06-20 Thread Quint
Should these RecordDeleter and RecordUpdater be in the response when 
cachable = True is used?

-- 

--- 
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] Markmin, LaTeX and pdf generation

2013-06-20 Thread peibol
Hi all

I'm getting in love with web2py, but I'm just a newcomer, and need some 
advice. Take into account that I finally want to deploy my app on GAE (so I 
can't install pdflatex for example).

1- I have configured my views to use mathjax (in the head section). Is it 
the right way to proceed with markmin? Cause mathjax is cooler than the 
google api that produces images...

2- I want to produce a pdf with some math formulas. I've managed to create 
a pdf in this way, but I don't know how to render the latex...:


def fractions1topdf():  
html=markmin2html('\( \cfrac{1}{3} + \cfrac{3}{4} = \)')
class MyFPDF(FPDF, HTMLMixin):
pass
pdf=MyFPDF()
pdf.add_page() 
pdf.set_font('Arial','B',16)
pdf.write_html(html) 
response.headers['Content-Type']='application/pdf' 
return pdf.output(dest='S') 

Thanks!!!

-- 

--- 
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: How should we work to sync localhost development with GAE?

2013-06-20 Thread peibol
No, I don't think there are two columns labelled 'title'.
I attach the csv...
Thanks for your interest

El miércoles, 19 de junio de 2013 17:55:27 UTC+2, Christian Foster Howes 
escribió:

 check your CSV file - that error looks to me like there are 2 columns 
 with the name title and therefore the DB does not know what data to 
 store where. 

 On 6/19/13 8:38 , peibol wrote: 
  Here is what I get: 
  
  
  Error ticket for myeducenterTicket ID 
  
  127.0.0.1.2013-06-19.17-34-43.e551a8f8-a45b-4b22-9e22-e76381dc5977 
  class 'sqlite3.IntegrityError' column title is not 
 uniqueVersi�nweb2py�Version 
  2.5.1-stable+timestamp.2013.06.11.08.00.05PythonPython 2.7.5: 
  c:\Python27\python.exe (prefix: c:\Python27)Traceback 
  
  1. 
  2. 
  3. 
  4. 
  5. 
  6. 
  7. 
  8. 
  9. 
  10. 
  11. 
  12. 
  13. 
  14. 
  15. 
  16. 
  17. 
  18. 
  
  Traceback (most recent call last): 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\restricted.py, 
 line 212, in restricted 
   exec ccode in environment 
 File E:/My 
 Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  
 
 http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py, 
 line 116, in module 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\globals.py, line 
 194, in lambda 
   self._caller = lambda f: f() 
 File E:/My 
 Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  
 
 http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py, 
 line 97, in import_and_sync 
   db.import_from_csv_file(form.vars.data.file,unique=False) 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8046, 
 in import_from_csv_file 
   *args, **kwargs) 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8737, 
 in import_from_csv_file 
   curr_id = self.insert(**dict(items)) 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8579, 
 in insert 
   ret =  self._db._adapter.insert(self, self._listify(fields)) 
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 1210, 
 in insert 
   raise e 
  IntegrityError: column title is not unique 
  
  
  
  El mi�rcoles, 19 de junio de 2013 17:31:49 UTC+2, Christian Foster 
 Howes 
  escribi�: 
  
  I haven't used that code in a long time as my tables are too big. :( 
  
  what's the traceback that you get? 
  
  On 6/19/13 7:23 , peibol wrote: 
  Bigtable. I don't have any other models but the standard auth ones and 
  the 
  builtin wiki ones and I'm using this code (just the one stated in the 
  book): 
  
  def import_and_sync(): 
form = FORM(INPUT(_type='file', _name='data'), 
  INPUT(_type='submit')) 
if form.process().accepted: 
db.import_from_csv_file(form.vars.data.file,unique=False) 
# for every table 
for table in db.tables: 
# for every uuid, delete all but the latest 
items = db(db[table]).select(db[table].id, 
   db[table].uuid, 
   orderby=db[table].modified_on, 
   groupby=db[table].uuid) 
for item in items: 
  
  db((db[table].uuid==item.uuid)(db[table].id!=item.id)).delete() 
return dict(form=form) 
  
  
  def export(): 
s = cStringIO.StringIO() 
db.export_to_csv_file(s) 
response.headers['Content-Type'] = 'text/csv' 
return s.getvalue() 
  
  
  
  
  
  El mi�rcoles, 19 de junio de 2013 15:14:57 UTC+2, Christian Foster 
  Howes 
  escribi�: 
  
  Are you using BigTable or Google Cloud SQL for data storage?  i'm 
  surprised that import to BigTable would give an integrity error. 
  
  note that if you are import/export as a controller you will be 
 limited 
  by what you can do in 128MB of ram and 60 seconds of processing 
 unless 
  you use larger instance classes and/or backend instances. 
  
  cfh 
  
  On 6/19/13 4:05 , peibol wrote: 
  Thanks Cristian. What I'm considering is use a export/import 
 function 
  in 
  the app, only visible to the administrator. Because I want to 
 develop 
  a 
  kind of wiki, with its content, on local. So I'll use 
  export_to_csv_file 
  and import_from_csv_file. 
  
  The export process is working for me right now, but the import 
 process 
  gives an integrity error. 
  
  Reading the book, it must be some issue with the uuids... 
  
  
  
  El mi�rcoles, 19 de junio de 2013 07:28:02 UTC+2, Christian Foster 
  Howes 
  escribi�: 
  
  i wouldn't copy data personally, i consider localhost a test 
  environment, 
  and GAE proper production and i just make my production data there. 
  
  if you do want to copy data look at the GAE bulk loader: 
  
  https://developers.google.com/appengine/docs/python/tools/uploadingdata 
  
  
  
  
  


-- 

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

Re: [web2py] Re: How should we work to sync localhost development with GAE?

2013-06-20 Thread Vinicius Assef
The error says you have 2 records with same value in the column title.

On Thu, Jun 20, 2013 at 12:56 PM, peibol pabe...@gmail.com wrote:
 No, I don't think there are two columns labelled 'title'.
 I attach the csv...
 Thanks for your interest

 El miércoles, 19 de junio de 2013 17:55:27 UTC+2, Christian Foster Howes
 escribió:

 check your CSV file - that error looks to me like there are 2 columns
 with the name title and therefore the DB does not know what data to
 store where.

 On 6/19/13 8:38 , peibol wrote:
  Here is what I get:
 
 
  Error ticket for myeducenterTicket ID
 
  127.0.0.1.2013-06-19.17-34-43.e551a8f8-a45b-4b22-9e22-e76381dc5977
  class 'sqlite3.IntegrityError' column title is not
  uniqueVersi�nweb2py�Version
  2.5.1-stable+timestamp.2013.06.11.08.00.05PythonPython 2.7.5:
  c:\Python27\python.exe (prefix: c:\Python27)Traceback
 
  1.
  2.
  3.
  4.
  5.
  6.
  7.
  8.
  9.
  10.
  11.
  12.
  13.
  14.
  15.
  16.
  17.
  18.
 
  Traceback (most recent call last):
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\restricted.py,
  line 212, in restricted
   exec ccode in environment
 File E:/My
  Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py,
  line 116, in module
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\globals.py, line
  194, in lambda
   self._caller = lambda f: f()
 File E:/My
  Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py,
  line 97, in import_and_sync
   db.import_from_csv_file(form.vars.data.file,unique=False)
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8046,
  in import_from_csv_file
   *args, **kwargs)
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8737,
  in import_from_csv_file
   curr_id = self.insert(**dict(items))
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 8579,
  in insert
   ret =  self._db._adapter.insert(self, self._listify(fields))
 File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 1210,
  in insert
   raise e
  IntegrityError: column title is not unique
 
 
 
  El mi�rcoles, 19 de junio de 2013 17:31:49 UTC+2, Christian Foster
  Howes
  escribi�:
 
  I haven't used that code in a long time as my tables are too big. :(
 
  what's the traceback that you get?
 
  On 6/19/13 7:23 , peibol wrote:
  Bigtable. I don't have any other models but the standard auth ones and
  the
  builtin wiki ones and I'm using this code (just the one stated in the
  book):
 
  def import_and_sync():
form = FORM(INPUT(_type='file', _name='data'),
  INPUT(_type='submit'))
if form.process().accepted:
db.import_from_csv_file(form.vars.data.file,unique=False)
# for every table
for table in db.tables:
# for every uuid, delete all but the latest
items = db(db[table]).select(db[table].id,
   db[table].uuid,
   orderby=db[table].modified_on,
   groupby=db[table].uuid)
for item in items:
 
  db((db[table].uuid==item.uuid)(db[table].id!=item.id)).delete()
return dict(form=form)
 
 
  def export():
s = cStringIO.StringIO()
db.export_to_csv_file(s)
response.headers['Content-Type'] = 'text/csv'
return s.getvalue()
 
 
 
 
 
  El mi�rcoles, 19 de junio de 2013 15:14:57 UTC+2, Christian Foster
  Howes
  escribi�:
 
  Are you using BigTable or Google Cloud SQL for data storage?  i'm
  surprised that import to BigTable would give an integrity error.
 
  note that if you are import/export as a controller you will be
  limited
  by what you can do in 128MB of ram and 60 seconds of processing
  unless
  you use larger instance classes and/or backend instances.
 
  cfh
 
  On 6/19/13 4:05 , peibol wrote:
  Thanks Cristian. What I'm considering is use a export/import
  function
  in
  the app, only visible to the administrator. Because I want to
  develop
  a
  kind of wiki, with its content, on local. So I'll use
  export_to_csv_file
  and import_from_csv_file.
 
  The export process is working for me right now, but the import
  process
  gives an integrity error.
 
  Reading the book, it must be some issue with the uuids...
 
 
 
  El mi�rcoles, 19 de junio de 2013 07:28:02 UTC+2, Christian Foster
  Howes
  escribi�:
 
  i wouldn't copy data personally, i consider localhost a test
  environment,
  and GAE proper production and i just make my production data there.
 
  if you do want to copy data look at the GAE bulk loader:
 
  https://developers.google.com/appengine/docs/python/tools/uploadingdata
 
 
 
 
 

 --

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

[web2py] Re: problem with GAE ReferenceProperty

2013-06-20 Thread Massimo Di Pierro
Please open a ticket about this. 

On Thursday, 20 June 2013 17:00:09 UTC+2, Quint wrote:

 Hi,

 I have a problem when i perform a select() on a model with an 
 ReferenceProperty Field.
 I'am getting this error:

 *('ReferenceProperty' object has no attribute 'startswith',)*
 *
 *
 related but nor sure it's the same:
 https://groups.google.com/forum/?fromgroups#!topic/web2py/M7civkMWRyo

 and it occurs at this line in dal.py:

 def represent(self, obj, fieldtype):
 *field_is_type = fieldtype.startswith*
 if isinstance(obj, CALLABLETYPES):
 obj = obj()
 if isinstance(fieldtype, SQLCustomType):
 return fieldtype.encoder(obj)
 if isinstance(obj, (Expression, Field)):
 raise SyntaxError(non supported on GAE)
 if self.dbengine == 'google:datastore':
 if isinstance(fieldtype, gae.Property):
 return obj


 Now, at the time the exception occurs the Fieldtype is of type 
 ReferenceProperty which does not have a startswith attribute.

 When i move this line to another position, the error is gone.
 But i'm not familiar enough with the code to be sure this i the correct 
 solution.
 Maybe the source of the problem lies somewhere else..

 this works:

 def represent(self, obj, fieldtype):

 if isinstance(obj, CALLABLETYPES):
 obj = obj()
 if isinstance(fieldtype, SQLCustomType):
 return fieldtype.encoder(obj)
 if isinstance(obj, (Expression, Field)):
 raise SyntaxError(non supported on GAE)
 if self.dbengine == 'google:datastore':
 if isinstance(fieldtype, gae.Property):
 return obj

 *field_is_type = fieldtype.startswith*

 Any idea?

 thanks!





-- 

--- 
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: Unable to cache Row objects

2013-06-20 Thread Massimo Di Pierro
No

On Thursday, 20 June 2013 17:47:06 UTC+2, Quint wrote:

 Should these RecordDeleter and RecordUpdater be in the response when 
 cachable = True is used?

-- 

--- 
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: Markmin, LaTeX and pdf generation

2013-06-20 Thread peibol
Does it requires pdflatex, doesn't it? I think it's not supported in GAE.

El jueves, 20 de junio de 2013 18:59:44 UTC+2, Massimo Di Pierro escribió:

 Why not use markmin2latex or markmin2pdf (itsuses latex inside)

 On Thursday, 20 June 2013 17:53:58 UTC+2, peibol wrote:

 Hi all

 I'm getting in love with web2py, but I'm just a newcomer, and need some 
 advice. Take into account that I finally want to deploy my app on GAE (so I 
 can't install pdflatex for example).

 1- I have configured my views to use mathjax (in the head section). Is it 
 the right way to proceed with markmin? Cause mathjax is cooler than the 
 google api that produces images...

 2- I want to produce a pdf with some math formulas. I've managed to 
 create a pdf in this way, but I don't know how to render the latex...:


 def fractions1topdf():  
 html=markmin2html('\( \cfrac{1}{3} + \cfrac{3}{4} = \)')
 class MyFPDF(FPDF, HTMLMixin):
 pass
 pdf=MyFPDF()
 pdf.add_page() 
 pdf.set_font('Arial','B',16)
 pdf.write_html(html) 
 response.headers['Content-Type']='application/pdf' 
 return pdf.output(dest='S') 

 Thanks!!!



-- 

--- 
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: How should we work to sync localhost development with GAE?

2013-06-20 Thread peibol
Thanks

El jueves, 20 de junio de 2013 18:22:47 UTC+2, viniciusban escribió:

 The error says you have 2 records with same value in the column title. 

 On Thu, Jun 20, 2013 at 12:56 PM, peibol pab...@gmail.com javascript: 
 wrote: 
  No, I don't think there are two columns labelled 'title'. 
  I attach the csv... 
  Thanks for your interest 
  
  El miércoles, 19 de junio de 2013 17:55:27 UTC+2, Christian Foster Howes 
  escribió: 
  
  check your CSV file - that error looks to me like there are 2 columns 
  with the name title and therefore the DB does not know what data to 
  store where. 
  
  On 6/19/13 8:38 , peibol wrote: 
   Here is what I get: 
   
   
   Error ticket for myeducenterTicket ID 
   
   127.0.0.1.2013-06-19.17-34-43.e551a8f8-a45b-4b22-9e22-e76381dc5977 
   class 'sqlite3.IntegrityError' column title is not 
   uniqueVersi�nweb2py�Version 
   2.5.1-stable+timestamp.2013.06.11.08.00.05PythonPython 2.7.5: 
   c:\Python27\python.exe (prefix: c:\Python27)Traceback 
   
   1. 
   2. 
   3. 
   4. 
   5. 
   6. 
   7. 
   8. 
   9. 
   10. 
   11. 
   12. 
   13. 
   14. 
   15. 
   16. 
   17. 
   18. 
   
   Traceback (most recent call last): 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\restricted.py, 
   line 212, in restricted 
exec ccode in environment 
  File E:/My 
   
 Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  

   
 http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py, 

   line 116, in module 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\globals.py, 
 line 
   194, in lambda 
self._caller = lambda f: f() 
  File E:/My 
   
 Dropbox/myWebs/MyApps/myeduapps/applications/myeducenter/controllers/default.py
  

   
 http://127.0.0.1:8083/admin/default/edit/myeducenter/controllers/default.py, 

   line 97, in import_and_sync 
db.import_from_csv_file(form.vars.data.file,unique=False) 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 
 8046, 
   in import_from_csv_file 
*args, **kwargs) 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 
 8737, 
   in import_from_csv_file 
curr_id = self.insert(**dict(items)) 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 
 8579, 
   in insert 
ret =  self._db._adapter.insert(self, self._listify(fields)) 
  File E:\My Dropbox\myWebs\MyApps\myeduapps\gluon\dal.py, line 
 1210, 
   in insert 
raise e 
   IntegrityError: column title is not unique 
   
   
   
   El mi�rcoles, 19 de junio de 2013 17:31:49 UTC+2, Christian Foster 
   Howes 
   escribi�: 
   
   I haven't used that code in a long time as my tables are too big. :( 
   
   what's the traceback that you get? 
   
   On 6/19/13 7:23 , peibol wrote: 
   Bigtable. I don't have any other models but the standard auth ones 
 and 
   the 
   builtin wiki ones and I'm using this code (just the one stated in 
 the 
   book): 
   
   def import_and_sync(): 
 form = FORM(INPUT(_type='file', _name='data'), 
   INPUT(_type='submit')) 
 if form.process().accepted: 
 db.import_from_csv_file(form.vars.data.file,unique=False) 
 # for every table 
 for table in db.tables: 
 # for every uuid, delete all but the latest 
 items = db(db[table]).select(db[table].id, 
db[table].uuid, 
orderby=db[table].modified_on, 
groupby=db[table].uuid) 
 for item in items: 
   
   db((db[table].uuid==item.uuid)(db[table].id!=item.id)).delete() 
 return dict(form=form) 
   
   
   def export(): 
 s = cStringIO.StringIO() 
 db.export_to_csv_file(s) 
 response.headers['Content-Type'] = 'text/csv' 
 return s.getvalue() 
   
   
   
   
   
   El mi�rcoles, 19 de junio de 2013 15:14:57 UTC+2, Christian 
 Foster 
   Howes 
   escribi�: 
   
   Are you using BigTable or Google Cloud SQL for data storage?  i'm 
   surprised that import to BigTable would give an integrity error. 
   
   note that if you are import/export as a controller you will be 
   limited 
   by what you can do in 128MB of ram and 60 seconds of processing 
   unless 
   you use larger instance classes and/or backend instances. 
   
   cfh 
   
   On 6/19/13 4:05 , peibol wrote: 
   Thanks Cristian. What I'm considering is use a export/import 
   function 
   in 
   the app, only visible to the administrator. Because I want to 
   develop 
   a 
   kind of wiki, with its content, on local. So I'll use 
   export_to_csv_file 
   and import_from_csv_file. 
   
   The export process is working for me right now, but the import 
   process 
   gives an integrity error. 
   
   Reading the book, it must be some issue with the uuids... 
   
   
   
   El mi�rcoles, 19 de junio de 2013 07:28:02 UTC+2, Christian 
 Foster 
   Howes 
   

[web2py] Re: Markmin, LaTeX and pdf generation

2013-06-20 Thread Massimo Di Pierro
Why not use markmin2latex or markmin2pdf (itsuses latex inside)

On Thursday, 20 June 2013 17:53:58 UTC+2, peibol wrote:

 Hi all

 I'm getting in love with web2py, but I'm just a newcomer, and need some 
 advice. Take into account that I finally want to deploy my app on GAE (so I 
 can't install pdflatex for example).

 1- I have configured my views to use mathjax (in the head section). Is it 
 the right way to proceed with markmin? Cause mathjax is cooler than the 
 google api that produces images...

 2- I want to produce a pdf with some math formulas. I've managed to create 
 a pdf in this way, but I don't know how to render the latex...:


 def fractions1topdf():  
 html=markmin2html('\( \cfrac{1}{3} + \cfrac{3}{4} = \)')
 class MyFPDF(FPDF, HTMLMixin):
 pass
 pdf=MyFPDF()
 pdf.add_page() 
 pdf.set_font('Arial','B',16)
 pdf.write_html(html) 
 response.headers['Content-Type']='application/pdf' 
 return pdf.output(dest='S') 

 Thanks!!!



-- 

--- 
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: Unable to cache Row objects

2013-06-20 Thread Quint
I did some digging around:

After i changed this piece of code in GoogleDatastoreAdapter, the cacheable 
attribute was passed to the *parse() *method in BaseAdapter.
Before the change it wasn't and thus cacheable was always the default value 
False.

def select(self,query,fields,attributes):
   [...]

colnames = ['%s.%s' % (tablename, t) for t in fields]
processor = attributes.get('processor',self.parse)
*cacheable = attributes.get('cacheable',False)*
# return processor(rows,fields,colnames,False)
   * return processor(rows,fields,colnames,False, cacheable=cacheable)*


after this change i noticed that in the resulting Rows, the id prop 
contained an instance of my model in stead of a numeric id.

So i changed some lines in parse() in BaseAdapter and after those changes, 
the resulting rows collection looks alright:

*old:*

  if ft == 'id' and not cacheable:
# temporary hack to deal with
# GoogleDatastoreAdapter
# references
if isinstance(self, GoogleDatastoreAdapter):
id = value.key().id_or_name()
colset[fieldname] = id
colset.gae_item = value
else:
id = value
colset.update_record = RecordUpdater(colset,table,id)
colset.delete_record = RecordDeleter(table,id)
for rfield in table._referenced_by:
referee_link = db._referee_name and \
db._referee_name % dict(
table=rfield.tablename,field=rfield.name)
if referee_link and not referee_link in colset:
colset[referee_link] = LazySet(rfield,id)

*new:*
*
*
  if ft == 'id':
# temporary hack to deal with
# GoogleDatastoreAdapter
# references
if isinstance(self, GoogleDatastoreAdapter):
id = value.key().id_or_name()
colset[fieldname] = id
colset.gae_item = value
else:
id = value
if not cacheable:
colset.update_record = RecordUpdater(colset,table,id)
colset.delete_record = RecordDeleter(table,id)
for rfield in table._referenced_by:
referee_link = db._referee_name and \
db._referee_name % dict(
table=rfield.tablename,field=rfield.name)
if referee_link and not referee_link in colset:
colset[referee_link] = LazySet(rfield,id)

But i'm still getting the same error. So it looks like cacheable=True 
does not solve this error.


-- 

--- 
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] compute try to understand something

2013-06-20 Thread Richard
Hello,

I don't understand why I have to redefine my compute field function...

I have a compute field like this one :

# model
db.define_table('mytable',
Field('f1', 'string'),
Field('review', 'boolean'),
Field('record_review_status', compute=lambda record: 
return_computed(record, request.args(0)))

# contoller
def fun():
form = SQLFORM.factory(Field(...))
session.rows = db(db[request.args(0)].review == False).select()
table = SQLTABLE(session.rows...)
form.process().accepted:
for r in session.rows: 
row = db[request.args(0)](r.id)
row.update_record(review='TRUE')
db.commit()
row = db[request.args(0)](r.id)
*row.record_review_status = return_record_review_status(row, 
request.args(0)) # here I need to redefine my record_review_status compute 
field or it not get computed*
row.update_record()
db.commit()
...

Note : It is pseudo code, so it may seems dumb or not working, I just try 
to make an example of what going on in my app...

In the book it is said that if we try to update record without passing, 
web2py tries to compute compute field base on orther field value... 

http://web2py.com/books/default/chapter/29/06?search=compute#Computed-fields

By the way, this part of the book is not pretty clear... For instance do I 
have to leave update() of update_record() blank in order to get my compute 
field to be computed.

Also, it is not exactly clear to me why my compute field not get compute on 
row.update_record(review='TRUE')... What I understand is that I need to 
explicitly update my compute field, but the way to do it seems to passing 
not paramaters to update() or update_record().

In my case, it seems that my compute function can't get the 'TRUE' for 
review only once the update(review='TRUE') is committed... I try to remove 
the line in bold, because it already in my model, but it is not working, my 
compute field never get updated it status.

Thanks to clarify this to me.

Richard

-- 

--- 
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: problem with a date in a form

2013-06-20 Thread palomar
yes, I'm italian :D
I've already check it
in my it.py is
%d/%m/%Y

for the input I use the calendar I have, for exeple
20/06/2013

and the error say me
enter date as 28/08/1963 
and the date is in that format!

-- 

--- 
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] Automatic Field representation without rows object?

2013-06-20 Thread anonymouse
Hi all,

I was playing with record/field representation and was wondering if there 
is a simple solution for my problem.

Here's what I'm trying to do -- print out a record using the represent 
function from the DB table. 

Here's my model:

models/document.py
db.define_table('document',
  Field('name', required=True, label='File Name'),
  Field('type', required=True),
  Field('ext'),
  Field('file', 'upload'),
  Field('created_on', 'datetime', default=request.now),
  Field('created_by', 'reference auth_user', default=auth.user_id),
  format='%(name)s'
)
db.document.id.represent = lambda val,r: SPAN(A('view' if r.type=='image' 
else 'get', _href='/img/' + str(val)))
db.document.created_on.represent = lambda val: val.strftime('%Y-%m-%d %H:%M'
) if val else 'NULL'


This for a view works OK:

{{=TABLE(records)}}

But it's not very pretty and I don't need to list all the fields, the 
header values are ugly and I don't really want to use a table anyhow. 
document.iddocument.namedocument.typedocument.extdocument.file
document.created_ondocument.created_byviewhttps://ara.wipac.wisc.edu/img/5
Mayan-Calendarimage.jpegfile2013-06-17 
16:03usernamegethttps://ara.wipac.wisc.edu/img/4
adwawdocument.docxfile2013-06-17 
15:16usernamegethttps://ara.wipac.wisc.edu/img/3
thesis-1784...document.pdffile2013-06-17 
15:16usernameviewhttps://ara.wipac.wisc.edu/img/2
hose_reelimage.jpgfile2013-06-17 
14:59usernamegethttps://ara.wipac.wisc.edu/img/1
jobsdocument.docxfile2013-06-17 14:58username
So the natural thing for me to do is to loop over the records as such:

{{
  for r in records:
cols = [
 DIV(r.id, _class='media-id'),
 DIV(r.name, _class='media-name'),
 DIV(r.type, _class='media-type'),
 DIV(r.created_on.strftime('%Y-%m-%d %H:%M'), _class='media-timestamp'),
 DIV(r.created_by, _class='media-owner'),
]
=DIV(*cols, _class='media-row')
  pass
}}

Which yields (with the proper css of course):

5
Mayan-Calendar
image
2013-06-17 16:03:04
1
4
adwaw
document
2013-06-17 15:16:19
1
3
thesis-1784
document
2013-06-17 15:16:09
1
2
hose_reel
image
2013-06-17 14:59:11
1
1
jobs
document
2013-06-17 14:58:07
1

(I also tried for r in records: TR(r) pass inside of a table -- it seems 
that only Rows objects represent the fields properly, not Row objects)

But now the ID field and the created_on field do not use the representation 
I've specified nor does created_by use the default auth_user representation.

So I try this -- create a function called rep that represents the thing 
from it's database table (which means now I have to send the table to the 
view or just assume the table name in the view) -- which ends up being a 
little bit of a pain:

{{
  def rep(record, field, tag=DIV, class_part=None):
fr = table[field].represent
args = None
val = record[field]

if fr and fr.func_code.co_argcount == 1:
  val = fr(record[field])
elif fr and fr.func_code.co_argcount == 2:
  val = fr(record[field], record)
pass  
 
#if fr and args:
#  val = fr(*args)
#pass

if not class_part:
  class_part = field
pass

return tag(val, _class='media-%s' % class_part)
}}  
...
{{
  for r in records: 
cols = [
  rep(r, 'id'), 
  rep(r, 'name'),
  rep(r, 'type'),
  rep(r, 'created_by', class_part='owner'),
  rep(r, 'created_on', class_part='time'),
=DIV(*cols, _class='media-row')
  pass
}}

Ok, so now I have this:

view https://ara.wipac.wisc.edu/img/5
Mayan-Calendar
image
1
2013-06-17 16:03
get https://ara.wipac.wisc.edu/img/4
adwaw
document
1
2013-06-17 15:16
get https://ara.wipac.wisc.edu/img/3
thesis-1784
document
1
2013-06-17 15:16
view https://ara.wipac.wisc.edu/img/2
allwell
image
1
2013-06-17 14:59
get https://ara.wipac.wisc.edu/img/1
jobs
document
1
2013-06-17 14:58



But now still doesn't pick up the representation of the auth_user table 
(i.e. the 1 column), 

So now I have to explicitly define the representation of the created_by 
field of db.document to reference db.auth_user.username or 
first_name/last_name or whatever.

MY QUESTIONs are -- 

1) Am I missing something with the abilities of 'represent' to easily 
represent records' field values?

2) is there a way, given a *row* object, to very easily (e.g. not writing 
supporting code beyond lambda statements) represent the field value without 
explicitly calling the db.table.field.represent() function on the field 
value?

3) would it be feasible and recommended to create a simple class that takes 
Rows objects and creates a DIV-based representation? How might I go about 
doing this if so? 

Any other suggestions that accomplish my goals are welcome. Thanks all!


PS: running web2py v2.4.6-stable (2013-4-6 17:37)

-- 

--- 
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 

[web2py] Re: problem with a date in a form

2013-06-20 Thread Niphlod
uhm. Italian here too, but I don't have that problem. Something must be 
missing / must be incorrect in your app.
Can you pack a minimal app to reproduce the issue ?

On Thursday, June 20, 2013 7:17:49 PM UTC+2, palomar wrote:

 yes, I'm italian :D
 I've already check it
 in my it.py is
 %d/%m/%Y

 for the input I use the calendar I have, for exeple
 20/06/2013

 and the error say me
 enter date as 28/08/1963 
 and the date is in that format!


-- 

--- 
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: Automatic Field representation without rows object?

2013-06-20 Thread Anthony


 1) Am I missing something with the abilities of 'represent' to easily 
 represent records' field values?


I think the represent attribute is currently only used in SQLTABLE, 
SQLFORM.grid (and smartgrid), and in forms (i.e., read-only fields), so no, 
I don't think you're missing anything.
 

 2) is there a way, given a *row* object, to very easily (e.g. not writing 
 supporting code beyond lambda statements) represent the field value without 
 explicitly calling the db.table.field.represent() function on the field 
 value?


Don't think so, but you should be able to do 
db.mytable.myfield.represent(row.myfield, 
row).
 

 3) would it be feasible and recommended to create a simple class that 
 takes Rows objects and creates a DIV-based representation? How might I go 
 about doing this if so?


Not a bad idea. Maybe have a look at how SQLTABLE and SQLFORM.grid (both in 
gluon.sqlhtml.py) handle field representation. Very simply, we might add a 
method to the Row class allowing something like:

row.represent('myfield')

and maybe row.represent(), with no arguments, could return a copy of the 
row object with all the fields transformed based on their represent 
attribute. This approach wouldn't involve any HTML, so you would be free to 
use the values however, without being constrained by some fixed HTML 
structure.

Anthony

-- 

--- 
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: SQLFORM.factory and list:integer error

2013-06-20 Thread Niphlod
you upgraded, but the patch isn't there. as you may notice, the exception 
raises at the exact same line as before.

I just sent an email to Massimo to let him know that ATM the fix isn't in 
trunk

http://code.google.com/p/web2py/issues/detail?id=1547

On Thursday, June 20, 2013 4:29:51 PM UTC+2, Martin Barnard wrote:

 Upgraded, but the error is still there. It's failing at the SQLFORM 
 validation in dal.py, I don't even get the chance to access session 
 variables myself. Also, list:integer fields leave an empty field behind

 Is there a way from within the DAL to remove empty entries on list:integer 
 (as I can't rely on my users to not create empty entries when using the 
 form)?

 def index():
 
 
 form=SQLFORM.factory(
 Field('employees', 'list:integer' ),
 )
 my_emps=[]
 if form.process(session=None).accepted:
 mvars=form.vars.employees
 if mvars:
 response.flash=myvars
 for a in mvars:
 my_emps.append(a)
 else:
 my_emps.append(mvars)

 return dict(form=form, my_emps=my_emps)


 Error:


 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted
 exec ccode in environment
   File 
 /home/www-data/web2py/applications/experiment/controllers/default.py, line 
 196, in module
   File /home/www-data/web2py/gluon/globals.py, line 194, in lambda
 self._caller = lambda f: f()
   File 
 /home/www-data/web2py/applications/experiment/controllers/default.py, line 
 127, in index
 if form.process(session=None).accepted:
   File /home/www-data/web2py/gluon/html.py, line 2188, in process
 self.validate(**kwargs)
   File /home/www-data/web2py/gluon/html.py, line 2127, in validate
 if self.accepts(**kwargs):
   File /home/www-data/web2py/gluon/sqlhtml.py, line 1571, in accepts
 self.vars.id = self.table.insert(**fields)
   File /home/www-data/web2py/gluon/dal.py, line 8598, in insert
 ret =  self._db._adapter.insert(self, self._listify(fields))
   File /home/www-data/web2py/gluon/dal.py, line 1203, in insert
 query = self._insert(table,fields)
   File /home/www-data/web2py/gluon/dal.py, line 1194, in _insert
 values = ','.join(self.expand(v, f.type) for f, v in fields)
   File /home/www-data/web2py/gluon/dal.py, line 1194, in genexpr
 values = ','.join(self.expand(v, f.type) for f, v in fields)
   File /home/www-data/web2py/gluon/dal.py, line 1376, in expand
 return str(self.represent(expression,field_type))
   File /home/www-data/web2py/gluon/dal.py, line 1805, in represent
 obj = map(int,obj)
 ValueError: invalid literal for int() with base 10: ''







 On Thursday, June 20, 2013 2:31:51 PM UTC+3, Martin Barnard wrote:

 That code listing is from dal.py. I didn't really want to poke too much 
 at that as I haven't had time to examine it too deeply. 

 I should probably upgrade to latest web2py before trying anything else :)

 */scurries off to upgrade the server...*

 On Thursday, June 20, 2013 12:45:28 AM UTC+3, Niphlod wrote:

 it's a bug reproduceable only if you leave one empty field.
 BTW, you're parsing it wrong given a single field filled with 1234, 
 you get [1,2,3,4] back.

 you should do

 vars = form.vars.employees
 if vars:
 if isinstance(vars, (list, tuple)):
 for a in vars:
 ids.append(a)
 else:
 ids.append(vars)

 Anyway, I'll submit an issue with the fix.


- 









-- 

--- 
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] Resume a session

2013-06-20 Thread Martin Weissenboeck
A function of my web2py app calls an external website. This website creates
a pdf-file and calls another function of my website, which should load this
pdf-file. Therefore this call should resume the first session. Is it
possible?

Regards Martin

-- 

--- 
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: Sending smartgrid search results to another controller

2013-06-20 Thread David
Solved my own problem, I don't know how I read past selectable in the grid 
documentation. 

Thanks,

David

On Thursday, June 20, 2013 12:12:10 AM UTC-4, David wrote:

 Hello,

 I am hoping that this is a simple question. I am looking for a way to send 
 the results of a SQLFORM.smartgrid search results (or just a specific 
 column) to another controller. Any insights on how to accomplish this?

 Thank you,

 David




-- 

--- 
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: computed fields ... order of calculation?

2013-06-20 Thread Tim Richardson
There's a pull request for this. If it's ok I'll add a test.





-- 

--- 
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: Help on field default computed value

2013-06-20 Thread greenpoise
db.define_table('series',
   Field('seriesnumber',compute=lambda r: '%s%s' (r['id'],r['seriesname'][0:
3]))
   Field('seriesname'),
   Field('seriesdescription'),
   Field('layertype','reference layertype'),
   Field('created_by',db.auth_user,default=me,writable=False,readable=False
),
   Field('created_on','datetime',default=request.now,writable=False,readable
=False),
   Field('suppliercode','reference supplier'))
db.series.seriesnumber.requires = IS_NOT_IN_DB(db,db.series.seriesnumber)
db.series.seriesname.requires = IS_NOT_IN_DB(db,db.series.seriesname)
db.series.layertype.requires = IS_IN_DB(db,db.layertype.id,'%(layername)s')
db.series.suppliercode.requires = IS_IN_DB(db,db.supplier.id,
'%(suppliercode)s')

Hi there! the code is above. Nothing fancy, I am testing it through the 
database administration tool provided by web2py. The record goes in but I 
get no value for seriesnumber. 

Thanks!

Dan

On Wednesday, June 19, 2013 11:27:40 AM UTC-7, greenpoise wrote:

 how come this returns null:

  Field('seriesnumber',compute=lambda r: '%s%s'% 
 (r['id'],r['seriesname'][0:3]))


-- 

--- 
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: Markmin, LaTeX and pdf generation

2013-06-20 Thread Massimo Di Pierro
You are right. No latex on GAE. I cannot think of any other way to render 
formulas in PDF without latex.

On Thursday, 20 June 2013 12:04:18 UTC-5, peibol wrote:

 Does it requires pdflatex, doesn't it? I think it's not supported in GAE.

 El jueves, 20 de junio de 2013 18:59:44 UTC+2, Massimo Di Pierro escribió:

 Why not use markmin2latex or markmin2pdf (itsuses latex inside)

 On Thursday, 20 June 2013 17:53:58 UTC+2, peibol wrote:

 Hi all

 I'm getting in love with web2py, but I'm just a newcomer, and need some 
 advice. Take into account that I finally want to deploy my app on GAE (so I 
 can't install pdflatex for example).

 1- I have configured my views to use mathjax (in the head section). Is 
 it the right way to proceed with markmin? Cause mathjax is cooler than the 
 google api that produces images...

 2- I want to produce a pdf with some math formulas. I've managed to 
 create a pdf in this way, but I don't know how to render the latex...:


 def fractions1topdf():  
 html=markmin2html('\( \cfrac{1}{3} + \cfrac{3}{4} = \)')
 class MyFPDF(FPDF, HTMLMixin):
 pass
 pdf=MyFPDF()
 pdf.add_page() 
 pdf.set_font('Arial','B',16)
 pdf.write_html(html) 
 response.headers['Content-Type']='application/pdf' 
 return pdf.output(dest='S') 

 Thanks!!!



-- 

--- 
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] compute try to understand something

2013-06-20 Thread Massimo Di Pierro
I think the problem is that your form does not contain enough info for the 
computed field. You correctly pull them from DB (in row) and pass to the 
compute function.

On Thursday, 20 June 2013 12:13:16 UTC-5, Richard wrote:

 Hello,

 I don't understand why I have to redefine my compute field function...

 I have a compute field like this one :

 # model
 db.define_table('mytable',
 Field('f1', 'string'),
 Field('review', 'boolean'),
 Field('record_review_status', compute=lambda record: 
 return_computed(record, request.args(0)))

 # contoller
 def fun():
 form = SQLFORM.factory(Field(...))
 session.rows = db(db[request.args(0)].review == False).select()
 table = SQLTABLE(session.rows...)
 form.process().accepted:
 for r in session.rows: 
 row = db[request.args(0)](r.id)
 row.update_record(review='TRUE')
 db.commit()
 row = db[request.args(0)](r.id)
 *row.record_review_status = return_record_review_status(row, 
 request.args(0)) # here I need to redefine my record_review_status compute 
 field or it not get computed*
 row.update_record()
 db.commit()
 ...

 Note : It is pseudo code, so it may seems dumb or not working, I just try 
 to make an example of what going on in my app...

 In the book it is said that if we try to update record without passing, 
 web2py tries to compute compute field base on orther field value... 


 http://web2py.com/books/default/chapter/29/06?search=compute#Computed-fields

 By the way, this part of the book is not pretty clear... For instance do I 
 have to leave update() of update_record() blank in order to get my compute 
 field to be computed.

 Also, it is not exactly clear to me why my compute field not get compute 
 on row.update_record(review='TRUE')... What I understand is that I need to 
 explicitly update my compute field, but the way to do it seems to passing 
 not paramaters to update() or update_record().

 In my case, it seems that my compute function can't get the 'TRUE' for 
 review only once the update(review='TRUE') is committed... I try to remove 
 the line in bold, because it already in my model, but it is not working, my 
 compute field never get updated it status.

 Thanks to clarify this to me.

 Richard


-- 

--- 
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: Resume a session

2013-06-20 Thread Massimo Di Pierro
Are you askin for another site (the one that creates the PDF) to be able to 
use your session? This would me a security issue. I am sure there is a 
better solution. Perhaps I do not understand. Can you tell us more about 
the workflow?

On Thursday, 20 June 2013 15:02:29 UTC-5, mweissen wrote:

 A function of my web2py app calls an external website. This website 
 creates a pdf-file and calls another function of my website, which should 
 load this pdf-file. Therefore this call should resume the first session. Is 
 it possible?

 Regards Martin


-- 

--- 
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] compute try to understand something

2013-06-20 Thread Richard Vézina
Ok, yes, it may not have some field that are to None... I had issue with
that that I have patch my compute function for. I should be the same...

Thank you Massimo to point me this out.

Richard


On Thu, Jun 20, 2013 at 5:02 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I think the problem is that your form does not contain enough info for the
 computed field. You correctly pull them from DB (in row) and pass to the
 compute function.


 On Thursday, 20 June 2013 12:13:16 UTC-5, Richard wrote:

 Hello,

 I don't understand why I have to redefine my compute field function...

 I have a compute field like this one :

 # model
 db.define_table('mytable',
 Field('f1', 'string'),
 Field('review', 'boolean'),
 Field('record_review_status', compute=lambda record:
 return_computed(record, request.args(0)))

 # contoller
 def fun():
 form = SQLFORM.factory(Field(...))
 session.rows = db(db[request.args(0)].review == False).select()
 table = SQLTABLE(session.rows...)
 form.process().accepted:
 for r in session.rows:
 row = db[request.args(0)](r.id)
 row.update_record(review='**TRUE')
 db.commit()
 row = db[request.args(0)](r.id)
 *row.record_review_status = return_record_review_status(row,
 request.args(0)) # here I need to redefine my record_review_status compute
 field or it not get computed*
 row.update_record()
 db.commit()
 ...

 Note : It is pseudo code, so it may seems dumb or not working, I just try
 to make an example of what going on in my app...

 In the book it is said that if we try to update record without passing,
 web2py tries to compute compute field base on orther field value...

 http://web2py.com/books/**default/chapter/29/06?search=**
 compute#Computed-fieldshttp://web2py.com/books/default/chapter/29/06?search=compute#Computed-fields

 By the way, this part of the book is not pretty clear... For instance do
 I have to leave update() of update_record() blank in order to get my
 compute field to be computed.

 Also, it is not exactly clear to me why my compute field not get compute
 on row.update_record(review='**TRUE')... What I understand is that I
 need to explicitly update my compute field, but the way to do it seems to
 passing not paramaters to update() or update_record().

 In my case, it seems that my compute function can't get the 'TRUE' for
 review only once the update(review='TRUE') is committed... I try to remove
 the line in bold, because it already in my model, but it is not working, my
 compute field never get updated it status.

 Thanks to clarify this to me.

 Richard

  --

 ---
 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.




-- 

--- 
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: row.id with L after upgrading to

2013-06-20 Thread Richard Vézina
Can someone point me out change log... I didn't see this one...

http://web2py.com/init/default/changelog

I think it is not in the change log and it is not acceptable

Thanks

Richard


On Wed, Jun 19, 2013 at 9:23 AM, palomar stefanob...@gmail.com wrote:

 thanks for your reply!

 --

 ---
 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.




-- 

--- 
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: web2pyslice and PIL thumbnail quality

2013-06-20 Thread Paolo valleri
I am not sure but the quality option could be for jpeg only.
Paolo
On Thursday, June 20, 2013 5:06:06 PM UTC+2, lesssugar wrote:

 A bit of offtopic but maybe someone knows what's going on. I'm using this 
 thumbnail generating slice I found:

 LINKhttp://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box

 All works fine but the problem I face is the thumbnails quality. I upload 
 really high-quality images and the generated thumbs are definitely not HQ.

 I tried adding *quality=90 *argument to these lines of smarthumb.py:
 *
 *
 img.thumbnail(box, Image.ANTIALIAS)

 and

 img.save(request.folder + 'uploads/' + thumb)

 respectively:

 img.save(request.folder + 'uploads/' + thumb, quality=90)
 and 
 img.save(request.folder + 'uploads/' + thumb, quality=90)

 -- no effect. Any ideas?





-- 

--- 
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: Markmin, LaTeX and pdf generation

2013-06-20 Thread peibol
Could it be feasible to use mathjax to render the latex to be put inside 
the pdf? Or the google api to generates the image and then add it to the 
pdf?

Thanks Massimo

El jueves, 20 de junio de 2013 23:00:25 UTC+2, Massimo Di Pierro escribió:

 You are right. No latex on GAE. I cannot think of any other way to render 
 formulas in PDF without latex.

 On Thursday, 20 June 2013 12:04:18 UTC-5, peibol wrote:

 Does it requires pdflatex, doesn't it? I think it's not supported in GAE.

 El jueves, 20 de junio de 2013 18:59:44 UTC+2, Massimo Di Pierro escribió:

 Why not use markmin2latex or markmin2pdf (itsuses latex inside)

 On Thursday, 20 June 2013 17:53:58 UTC+2, peibol wrote:

 Hi all

 I'm getting in love with web2py, but I'm just a newcomer, and need some 
 advice. Take into account that I finally want to deploy my app on GAE (so 
 I 
 can't install pdflatex for example).

 1- I have configured my views to use mathjax (in the head section). Is 
 it the right way to proceed with markmin? Cause mathjax is cooler than the 
 google api that produces images...

 2- I want to produce a pdf with some math formulas. I've managed to 
 create a pdf in this way, but I don't know how to render the latex...:


 def fractions1topdf():  
 html=markmin2html('\( \cfrac{1}{3} + \cfrac{3}{4} = \)')
 class MyFPDF(FPDF, HTMLMixin):
 pass
 pdf=MyFPDF()
 pdf.add_page() 
 pdf.set_font('Arial','B',16)
 pdf.write_html(html) 
 response.headers['Content-Type']='application/pdf' 
 return pdf.output(dest='S') 

 Thanks!!!



-- 

--- 
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: web2pyslice and PIL thumbnail quality

2013-06-20 Thread lesssugar
I think you're right. In addition, the *quality *attribute is not such an 
easy-peasy as I thought.

Some clarification from Stack Overflow: 
LINKhttp://stackoverflow.com/questions/4354543/determining-jpg-quality-in-python-pil

Need to dig deeper. Thanks, anyway.

On Thursday, June 20, 2013 11:24:55 PM UTC+2, Paolo valleri wrote:

 I am not sure but the quality option could be for jpeg only.
 Paolo
 On Thursday, June 20, 2013 5:06:06 PM UTC+2, lesssugar wrote:

 A bit of offtopic but maybe someone knows what's going on. I'm using this 
 thumbnail generating slice I found:

 LINKhttp://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box

 All works fine but the problem I face is the thumbnails quality. I upload 
 really high-quality images and the generated thumbs are definitely not HQ.

 I tried adding *quality=90 *argument to these lines of smarthumb.py:
 *
 *
 img.thumbnail(box, Image.ANTIALIAS)

 and

 img.save(request.folder + 'uploads/' + thumb)

 respectively:

 img.save(request.folder + 'uploads/' + thumb, quality=90)
 and 
 img.save(request.folder + 'uploads/' + thumb, quality=90)

 -- no effect. Any ideas?





-- 

--- 
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: Help on field default computed value

2013-06-20 Thread Anthony
The record ID isn't known until after the insert, so I don't think it can 
be used in a computed field. Perhaps you could use .after_insert and 
.after_update callbacks to do this.

Anthony

On Thursday, June 20, 2013 4:55:24 PM UTC-4, greenpoise wrote:

 db.define_table('series',
Field('seriesnumber',compute=lambda r: '%s%s' (r['id'],r['seriesname'][
 0:3]))
Field('seriesname'),
Field('seriesdescription'),
Field('layertype','reference layertype'),
Field('created_by',db.auth_user,default=me,writable=False,readable=
 False),
Field('created_on','datetime',default=request.now,writable=False,
 readable=False),
Field('suppliercode','reference supplier'))
 db.series.seriesnumber.requires = IS_NOT_IN_DB(db,db.series.seriesnumber)
 db.series.seriesname.requires = IS_NOT_IN_DB(db,db.series.seriesname)
 db.series.layertype.requires = IS_IN_DB(db,db.layertype.id,'%(layername)s'
 )
 db.series.suppliercode.requires = IS_IN_DB(db,db.supplier.id,
 '%(suppliercode)s')

 Hi there! the code is above. Nothing fancy, I am testing it through the 
 database administration tool provided by web2py. The record goes in but I 
 get no value for seriesnumber. 

 Thanks!

 Dan

 On Wednesday, June 19, 2013 11:27:40 AM UTC-7, greenpoise wrote:

 how come this returns null:

  Field('seriesnumber',compute=lambda r: '%s%s'% 
 (r['id'],r['seriesname'][0:3]))



-- 

--- 
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] php and web2py together in shared hosting

2013-06-20 Thread José Eloy
Hello!

This question was made by me several months ago. The matter is simple: How 
to serve php apps and web2py apps from the same shared hosting? In my case 
I'm using Hostgator. The web2py app is in the root of the domain (\www 
folder), the php is in a sub URL (from \www\phpAppFolder), but when I 
request the php app I always get Invalid Request. I think web2py is 
always catching the request and the php apps never is executed. 

Somebody can help me?

Thanks in advanced.


-- 

--- 
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: Automatic Field representation without rows object?

2013-06-20 Thread Anthony


 Not a bad idea. Maybe have a look at how SQLTABLE and SQLFORM.grid (both 
 in gluon.sqlhtml.py) handle field representation. Very simply, we might 
 add a method to the Row class allowing something like:

 row.represent('myfield')


Actually, Row objects don't know about their db/table, so you'd have to 
pass that in somehow. Rows objects do know their db, so it would be easier 
for an entire Rows object.

Anthony

-- 

--- 
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: php and web2py together in shared hosting

2013-06-20 Thread André Kablu
Hi,

The best way to do this is to create subdomains.

So you will have:

/home/user/www
/home/user/phpapp

and you can create a subdomain this way:

php.mydomain.com (that refers to /home/user/phpapp)

to call it directly using your main www.mydomain.com you can create a 
redirect app.

in web2py you can create a new app, that is called phpapp, and in the 
default controler, index function,  you do a redirect() to your 
php.mydomain.com

so if you call www.mydomain.com/phpapp it will automatically redirect you 
to php.mydomain.com and open your php application.


Hope it helps!


Em quinta-feira, 20 de junho de 2013 20h51min27s UTC-3, José Eloy escreveu:

 Hello!

 This question was made by me several months ago. The matter is simple: How 
 to serve php apps and web2py apps from the same shared hosting? In my case 
 I'm using Hostgator. The web2py app is in the root of the domain (\www 
 folder), the php is in a sub URL (from \www\phpAppFolder), but when I 
 request the php app I always get Invalid Request. I think web2py is 
 always catching the request and the php apps never is executed. 

 Somebody can help me?

 Thanks in advanced.




-- 

--- 
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: Automatic Field representation without rows object?

2013-06-20 Thread Anthony
FYI, see possible solution 
here: https://groups.google.com/d/msg/web2py-developers/kMMG1wH6Xxg/pCYZfJGHVckJ

Anthony

On Thursday, June 20, 2013 8:22:54 PM UTC-4, Anthony wrote:


 Not a bad idea. Maybe have a look at how SQLTABLE and SQLFORM.grid (both 
 in gluon.sqlhtml.py) handle field representation. Very simply, we might 
 add a method to the Row class allowing something like:

 row.represent('myfield')


 Actually, Row objects don't know about their db/table, so you'd have to 
 pass that in somehow. Rows objects do know their db, so it would be easier 
 for an entire Rows object.

 Anthony


-- 

--- 
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.