[web2py] weird auth error

2013-03-28 Thread vince
i got this error once in a while, usually restart apache will fix it. it 
will only happens when using the auth module for login. any idea? the error 
log is short, any idea on how to trace out the problem?

i am running web2py 2.4.5-stable+timestamp.2013.03.18.22.46.22


Traceback (most recent call last):
  File /home/web2py/gluon/main.py, line 555, in wsgibase
session._try_store_in_db(request, response)
  File /home/web2py/gluon/globals.py, line 732, in _try_store_in_db
or self._forget or self._unchanged():
  File /home/web2py/gluon/globals.py, line 719, in _unchanged
session_pickled = cPickle.dumps(dict(self))
  File /usr/lib64/python2.6/copy_reg.py, line 84, in _reduce_ex
dict = getstate()
TypeError: 'NoneType' object is not callable

-- 

--- 
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] using the IS_URL validator with complex URLs

2013-03-28 Thread Niphlod
send a patch with tests and you'll have it :P

On Wednesday, March 27, 2013 11:12:02 PM UTC+1, Derek wrote:

 Also looks like the TLDs don't include the internationalized country code 
 top level domains, only the test ones.

 On Wednesday, March 27, 2013 2:57:00 PM UTC-7, Derek wrote:

 It should be checking against RFC 3986, not RFC 2396.

 On Wednesday, March 27, 2013 11:44:08 AM UTC-7, Jonathan Lundell wrote:

 On 27 Mar 2013, at 11:25 AM, Lamps902 dhea...@gmail.com wrote:

 It seems that every once in a while, the IS_URL validator doesn't want 
 to accept a URL that's valid. For example, I believe the ^ character 
 prevents IS_URL from accepting something like 
 http://finance.yahoo.com/q/hp?s=^IXIC+Historical+Priceshttp://finance.yahoo.com/q/hp?s=%5EIXIC+Historical+Prices.
  
 Is there a parameter to permit IS_URL to accept certain special characters, 
 or that makes the validator 'less strict', so that it can accept URLs such 
 as the one above? Thanks.



 IS_URL first checks the URL against RFC 2396, which requires '^' to be 
 escaped. I don't see a way to override it; better to URL-escape your URLs.



-- 

--- 
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] pySerial - how to open port

2013-03-28 Thread theofficialtoss
Hello everyone. 
I would like to use web2py as my Raspberry Pi webserver. i need to send 
some serial data from the web application to Raspberry Pi and send to a 
device. However, i encountered the error of  class 
‘serial.serialutil.SerialException’ could not open port /dev/ttyAMA0: 
[Errno 13] Permission denied: ‘/dev/ttyAMA0′ 

I have been stuck at this for weeks and i can't seem to find any solution 
except moving on to using cherrypy and jquery. :( but i really wish to use 
web2py!

So, i have this code below that could work fine using normal python script 
as well as cherrypy. in web2py, i put this under default.py and create a 
new def for it. 

import serial
import time

serialport= serial.Serial (/dev/ttyAMA0, 9600, timeout=0.5)
serialport.write(\x03LI1234\x0D)
response=serialport.readlines(1)
print response
time.sleep(1)

what could have been done wrongly? :(

-- 

--- 
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: pySerial - how to open port

2013-03-28 Thread Niphlod
there's no way that a module running on cherrypy doesn't work under web2py. 
Seems a permission problem, so you need to start web2py with the same user 
you're using for making that work with cherrypy.

-- 

--- 
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: format and represent on table

2013-03-28 Thread 黄祥
nope, it just the futsal app the one that is similar to hotel management 
appliance. the room in the the hotel management appliance i rename it into 
court for futsal court.

-- 

--- 
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] LOAD() and auth.requires_login() - Nice please login message??

2013-03-28 Thread Yoel Benítez Fonseca
El 27/03/13 19:16, Brian M escribió:
 I have a page that is using LOAD() to pull in a form that requires the
 user to be logged-in (@auth.requires_login())  In previous versions of
 web2py if the user hadn't yet logged in they'd get the login screen
 within the LOAD()'s DIV and at least could get an idea of what they
 needed to do before proceeding, but now with the current version they
 just see 401 NOT AUTHORIZED which just completely confuses my users.
  It appears that this change was made in response to issue 832
 https://code.google.com/p/web2py/issues/detail?can=1q=832colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summaryid=832
 in this commit
 https://github.com/web2py/web2py/commit/37acdc0cc66eec4c65fcf59b1136c2e3fda83d4b.
  Is there at least some way to specify my own message instead so it says
 something like Please log-in rather than 401 NOT AUTHORIZED?

i prefer (in view):

{{if auth.user:}}
   {{=LOAD('default','whatever.load',args=[a,b,c],ajax=True)}}
{{else:}}
div class=alert alert-info
{{=T(You must login to do ...)}}
/div
{{pass}}


--
Yoel.

-- 

--- 
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: A Web2py CMS like Joomla ?

2013-03-28 Thread damufo
Hi:
Wanted to start a project and wanted to know what you recommend for me.

From what I've seen there are several options

http://stackoverflow.com/questions/8161644/what-are-the-mature-cmss-and-blogs-built-on-web2py

What do you think of instantpress 2.0?
Another?
None?

Thanks!

On Friday, May 25, 2012 5:54:54 AM UTC+2, Andrew W wrote:

 There have been numerous posts on a web2py based cms, and I know there are 
 many solutions out there, at varying stages of development.   They each 
 have a different focus so it is not a simple question of which one is 
 best.  I won't try and mention them by name.

 However,  A colleague of mine was talking about Joomla and I wanted to be 
 able to offer some strategy on a comparable web2py cms.   Would anyone 
 care to comment on which of the web2py cms' would be a contender to Joomla 
 ?  If not now, perhaps with a roadmap for the future.

 Personally, and I've said it before,  cms functionality is very important, 
 and I think we should highlight the cms offerings on the web2py website.  
 Not necessarily one, but showcase the best of For example, look 
 at http://www.zope.org/the-world-of-zope   It mentions Plone and Silva.  
 Such a thing would also strenghten the adopton of web2py.  Are they 
 production ready enough to do that ?

 Thankyou.

 Andrew W


-- 

--- 
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] %26 in url causes url parsing error

2013-03-28 Thread Jonathan New
I found out that web2py cannot parse url contains args like 
/app/controller/func/value%26value

It will throw 400 BAD REQUEST.

Inspecting the response header also shows:
web2py_error: invalid arg some valuevalue

I'm using web2py 2.4.5

-- 

--- 
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] Issues running auth.wiki() based app in GAE launcher

2013-03-28 Thread Spring
Hi there,

After developing the app in Web2py IDE I'm trying to run it in GAE 
launcher. Some issues encountered:

1. Two users created in database in IDE, register disabled. When firing up 
the page, login page popped up as designed but I couldn't login with 
existing user account (possibly because database not indexed yet). 
Re-enable registration and create the account which is supposed to already 
exist in database, succeeded and the logged in.  This basically means 
database is empty now uder GAE launcher.

2. All pages created under auth.wiki() are gone. only showing '[wiki]' tag. 
This is could be the same reason of database records since those pages are 
stored in wiki page tables. 

Can someone advise on the solutions? Thanks.

Spring

-- 

--- 
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] automatically generating md5 hash after a file upload

2013-03-28 Thread smoggy
Hello folks,

So i want to generate a md5 hash of uploaded files. How can this be done ? 
here is my attempt

with the following code i get

AttributeError: 'str' object has no attribute 'retrieve'

So obviously the row elements are not Field type, and since i'm a python 
newbie i couldn't figure this. Can anybody tip me on this ?


def md5_for_file(f):
... 
return md5.digest()

db.define_table('t_products',
 Field('id','id'),
 Field('f_file_xplatform', type='upload'),
 Field('f_file_xplatform_hash', type='string',label=T('Source File Hash')),
 Field('f_file_xplatform_download_name', 'string', compute=lambda r: 
download_name(r,XPLATFORM)),
)

def download_name(in_row,in_os):
try:
tt_row = in_row['f_file_xplatform'].retrieve(nameonly=True)
print tt_row:   + tt_row
t_md5 = md5_for_file(tt_row[1])
in_row['f_file_xplatform_hash']=t_md5
return 'blabla.'+t_md5

except Exception, e:
import traceback
print traceback.format_exc()

-- 

--- 
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: Issues running auth.wiki() based app in GAE launcher

2013-03-28 Thread Niphlod
GAE doesn't work with sqlite, but with its own storage.. 
every data you stored in sqlite is not available.
If you want to migrate tables you can export them using appadmin while 
working on sqlite and then start the app in the GAE launcher and import the 
previously saved data into it.

On Thursday, March 28, 2013 11:41:11 AM UTC+1, Spring wrote:

 Hi there,

 After developing the app in Web2py IDE I'm trying to run it in GAE 
 launcher. Some issues encountered:

 1. Two users created in database in IDE, register disabled. When firing up 
 the page, login page popped up as designed but I couldn't login with 
 existing user account (possibly because database not indexed yet). 
 Re-enable registration and create the account which is supposed to already 
 exist in database, succeeded and the logged in.  This basically means 
 database is empty now uder GAE launcher.

 2. All pages created under auth.wiki() are gone. only showing '[wiki]' 
 tag. This is could be the same reason of database records since those pages 
 are stored in wiki page tables. 

 Can someone advise on the solutions? Thanks.

 Spring


-- 

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




[web2py] Re: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Alan Etkin


 I can make this. Translators need it.

 On Wednesday, 13 March 2013 06:01:01 UTC-5, david xiao wrote:

 Just wondering, if it's possible, i think i will be helpful to know the 
 new features.


I have a problem when diffing some chapters. I have used the command in the 
Github readme for each chapter.

The diffs from chapters 01, 03 and 04 almost double the original files in 
size. Were they completely changed or is there a problem with the use of 
diff? Here is what I run:

git diff -r 5a78edad03160fff97836b8a8d93d185b34d378d \
sources/29-web2py-english/number.markmin  \
~/w2pbookdiff/number.diff


-- 

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




[web2py] Re: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Niphlod
they were edited at least one time for each line, so the diff kinda reports 
all the removed and all the added lines alltogether.
That's one of the reasons I made diffbook hunks commit by commit.

On Thursday, March 28, 2013 12:51:54 PM UTC+1, Alan Etkin wrote:

 I can make this. Translators need it.

 On Wednesday, 13 March 2013 06:01:01 UTC-5, david xiao wrote:

 Just wondering, if it's possible, i think i will be helpful to know the 
 new features.


 I have a problem when diffing some chapters. I have used the command in 
 the Github readme for each chapter.

 The diffs from chapters 01, 03 and 04 almost double the original files in 
 size. Were they completely changed or is there a problem with the use of 
 diff? Here is what I run:

 git diff -r 5a78edad03160fff97836b8a8d93d185b34d378d \
 sources/29-web2py-english/number.markmin  \
 ~/w2pbookdiff/number.diff




-- 

--- 
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: Issues running auth.wiki() based app in GAE launcher

2013-03-28 Thread Spring
Hi Niphlod,

Thank you for the replay. It explains clearly. However, I understand how to 
export database from appadmin, but for importing do I have to write the 
function or there is similar function already provided in GAE Launcher?

Spring

在 2013年3月28日星期四UTC+8下午7时46分41秒,Niphlod写道:

 GAE doesn't work with sqlite, but with its own storage.. 
 every data you stored in sqlite is not available.
 If you want to migrate tables you can export them using appadmin while 
 working on sqlite and then start the app in the GAE launcher and import the 
 previously saved data into it.

 On Thursday, March 28, 2013 11:41:11 AM UTC+1, Spring wrote:

 Hi there,

 After developing the app in Web2py IDE I'm trying to run it in GAE 
 launcher. Some issues encountered:

 1. Two users created in database in IDE, register disabled. When firing 
 up the page, login page popped up as designed but I couldn't login with 
 existing user account (possibly because database not indexed yet). 
 Re-enable registration and create the account which is supposed to already 
 exist in database, succeeded and the logged in.  This basically means 
 database is empty now uder GAE launcher.

 2. All pages created under auth.wiki() are gone. only showing '[wiki]' 
 tag. This is could be the same reason of database records since those pages 
 are stored in wiki page tables. 

 Can someone advise on the solutions? Thanks.

 Spring



-- 

--- 
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: Issues running auth.wiki() based app in GAE launcher

2013-03-28 Thread Niphlod
you can import and export data from appadmin.

On Thursday, March 28, 2013 1:17:04 PM UTC+1, Spring wrote:

 Hi Niphlod,

 Thank you for the replay. It explains clearly. However, I understand how 
 to export database from appadmin, but for importing do I have to write the 
 function or there is similar function already provided in GAE Launcher?

 Spring

 在 2013年3月28日星期四UTC+8下午7时46分41秒,Niphlod写道:

 GAE doesn't work with sqlite, but with its own storage.. 
 every data you stored in sqlite is not available.
 If you want to migrate tables you can export them using appadmin while 
 working on sqlite and then start the app in the GAE launcher and import the 
 previously saved data into it.

 On Thursday, March 28, 2013 11:41:11 AM UTC+1, Spring wrote:

 Hi there,

 After developing the app in Web2py IDE I'm trying to run it in GAE 
 launcher. Some issues encountered:

 1. Two users created in database in IDE, register disabled. When firing 
 up the page, login page popped up as designed but I couldn't login with 
 existing user account (possibly because database not indexed yet). 
 Re-enable registration and create the account which is supposed to already 
 exist in database, succeeded and the logged in.  This basically means 
 database is empty now uder GAE launcher.

 2. All pages created under auth.wiki() are gone. only showing '[wiki]' 
 tag. This is could be the same reason of database records since those pages 
 are stored in wiki page tables. 

 Can someone advise on the solutions? Thanks.

 Spring



-- 

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




[web2py] Re: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Alan Etkin


 they were edited at least one time for each line, so the diff kinda 
 reports all the removed and all the added lines alltogether.
 That's one of the reasons I made diffbook hunks commit by commit.


Ok, I will check the diffbook then. 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] unique of multiple Field

2013-03-28 Thread frasse
Hi
I like  to make unique of 2 Field in my table. 
in this example I want myId + myThing be unique . How can I do this ?

db.define_table('myproperty',Field('myId', 'integer'),
Field('myThing', 'integer'),
Field('prize', 'double'),
Field('quantity', 'integer'),
Field('isInMarket', 'boolean', default = False ))

Thanks
/F

-- 

--- 
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: unique of multiple Field

2013-03-28 Thread Anthony
See https://groups.google.com/d/msg/web2py/CRPySzABQTk/8jylUabyFTQJ.

Anthony

On Thursday, March 28, 2013 9:22:33 AM UTC-4, frasse wrote:

 Hi
 I like  to make unique of 2 Field in my table. 
 in this example I want myId + myThing be unique . How can I do this ?

 db.define_table('myproperty',Field('myId', 'integer'),
 Field('myThing', 'integer'),
 Field('prize', 'double'),
 Field('quantity', 'integer'),
 Field('isInMarket', 'boolean', default = False ))

 Thanks
 /F


-- 

--- 
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] %26 in url causes url parsing error

2013-03-28 Thread Jonathan Lundell
On 28 Mar 2013, at 3:18 AM, Jonathan New new.jonat...@gmail.com wrote:
 I found out that web2py cannot parse url contains args like 
 /app/controller/func/value%26value
 
 It will throw 400 BAD REQUEST.
 
 Inspecting the response header also shows:
 web2py_error: invalid arg some valuevalue
 
 I'm using web2py 2.4.5
 

I suspect that the only way you're going to be able to have '' in your args is 
to use the parametric router and override args_match. 

-- 

--- 
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: Issues running auth.wiki() based app in GAE launcher

2013-03-28 Thread Spring
Right I don't why I got the idea Appadmin doesn't work in GAE, maybe 
during jump reading of some posting...
Problem solved. Thanks.

在 2013年3月28日星期四UTC+8下午8时25分12秒,Niphlod写道:

 you can import and export data from appadmin.

 On Thursday, March 28, 2013 1:17:04 PM UTC+1, Spring wrote:

 Hi Niphlod,

 Thank you for the replay. It explains clearly. However, I understand how 
 to export database from appadmin, but for importing do I have to write the 
 function or there is similar function already provided in GAE Launcher?

 Spring

 在 2013年3月28日星期四UTC+8下午7时46分41秒,Niphlod写道:

 GAE doesn't work with sqlite, but with its own storage.. 
 every data you stored in sqlite is not available.
 If you want to migrate tables you can export them using appadmin while 
 working on sqlite and then start the app in the GAE launcher and import the 
 previously saved data into it.

 On Thursday, March 28, 2013 11:41:11 AM UTC+1, Spring wrote:

 Hi there,

 After developing the app in Web2py IDE I'm trying to run it in GAE 
 launcher. Some issues encountered:

 1. Two users created in database in IDE, register disabled. When firing 
 up the page, login page popped up as designed but I couldn't login with 
 existing user account (possibly because database not indexed yet). 
 Re-enable registration and create the account which is supposed to already 
 exist in database, succeeded and the logged in.  This basically means 
 database is empty now uder GAE launcher.

 2. All pages created under auth.wiki() are gone. only showing '[wiki]' 
 tag. This is could be the same reason of database records since those 
 pages 
 are stored in wiki page tables. 

 Can someone advise on the solutions? Thanks.

 Spring



-- 

--- 
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: using a representation of an absolute URL to update a db?

2013-03-28 Thread Lamps902
Thanks to both of you guys! After a much needed rest, I got it working with 
a solution comparable to what you guys specified/described. 

Anthony - I noticed the book's section on using the *host* and 
*scheme*parameters for URL(), but was a bit thrown off - is there a way to use 
URL() to point to a page (i.e. google.com) outside of your site (whatever 
tinkering I did with URL(), it was always appending or prepending some 
elements of my site's address to the URL pointing to another page)?

-- 

--- 
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: using a representation of an absolute URL to update a db?

2013-03-28 Thread Anthony
The URL() function is primarily intended for generating web2py URLs, not 
external URLs. It will always add a controller and function (if none are 
specified, it will use the controller and function of the current request).

Anthony

On Thursday, March 28, 2013 10:36:15 AM UTC-4, Lamps902 wrote:

 Thanks to both of you guys! After a much needed rest, I got it working 
 with a solution comparable to what you guys specified/described. 

 Anthony - I noticed the book's section on using the *host* and 
 *scheme*parameters for URL(), but was a bit thrown off - is there a way to 
 use 
 URL() to point to a page (i.e. google.com) outside of your site (whatever 
 tinkering I did with URL(), it was always appending or prepending some 
 elements of my site's address to the URL pointing to another page)?


-- 

--- 
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: using a representation of an absolute URL to update a db?

2013-03-28 Thread Lamps902
Got it. Thank you!

On Thursday, March 28, 2013 9:41:03 AM UTC-5, Anthony wrote:

 The URL() function is primarily intended for generating web2py URLs, not 
 external URLs. It will always add a controller and function (if none are 
 specified, it will use the controller and function of the current request).

 Anthony

 On Thursday, March 28, 2013 10:36:15 AM UTC-4, Lamps902 wrote:

 Thanks to both of you guys! After a much needed rest, I got it working 
 with a solution comparable to what you guys specified/described. 

 Anthony - I noticed the book's section on using the *host* and 
 *scheme*parameters for URL(), but was a bit thrown off - is there a way to 
 use 
 URL() to point to a page (i.e. google.com) outside of your site 
 (whatever tinkering I did with URL(), it was always appending or prepending 
 some elements of my site's address to the URL pointing to another page)?



-- 

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




[web2py] Re: web2py, mod_proxy and redirection

2013-03-28 Thread Sean Murphy
Hi Niphlod,

Thanks for response.

On Tuesday, March 26, 2013 5:14:25 PM UTC+1, Niphlod wrote:

 well, the underlying problem with this architecture is that on / apache 
 rewrites internally from /whatever/whatever2 to /whatever/whatever2 on the 
 default instance. From this standpoint, the default behaviour of web2py is 
 tuned accordingly to what apache is doing.

 On /dev/ apache rewrites internally /dev/whatever/whatever2 to (I suspect) 
 /whatever/whatever2 on the dev instance.


Correct.
 

 But, web2py doesn't know that apache has done an internal rewrite, and 
 apache doesn't rewrite outcoming urls accordingly .


w2p does not know this - I was using proxypassreverse to make modifications 
to the
link on the way back.
 

 Unless you play a lot with rewritecond or proxypassreverse, the better way 
 is informing web2py in advance that every /whatever/whatever2 url needs to 
 be outputted as /dev/whatever/whatever2 , so you get a consistent behaviour 
 client-side  
 you have to play with your routes.py on the dev instance to make it behave 
 accordingly to what apache is doing.


Hmm...this results in more differences between the dev
version and the test version than I had hoped.

There seem to be quite a few posts in various places
on how to get w2p working with apache/mod_proxy,
often via a link such as hostname/web2py - it seems
that such scenarios should have the same problem.

BR,
Seán.

 

 On Tuesday, March 26, 2013 4:41:37 PM UTC+1, Sean Murphy wrote:

 Hi,

 I'm having problems with apache config of web2py.

 I'm trying to run a test server (which others can work against)
 and a dev server off the same apache server. Perhaps this is a
 little crazy, but that's how we're set up now.

 From the external pov, I'm trying to configure my server such
 that
 hostname/ goes to the test server and
 hostname/dev goes to the dev server

 I have the test server and the dev server installed as two
 seperate web2py instances.

 My problem relates to the dev server and login based redirection.

 When I go to

 https://hostname/dev/admin

 I'm presented with a login form, but the send parameter on
 the login points to /admin and not /dev/admin. More specifically,

 https://hostname/dev/admin/default/index?send=%2Fadmin%2Fdefault%2Flogin

 Hence the client tries to load hostname/admin/default/login (and not
 the dev version) on login.

 Do I need to do anything specific with mod_proxy to catch this?

 Thanks and rgds,
 Seán.





-- 

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




[web2py] Re: Auth with Janrain but still require registration

2013-03-28 Thread DeanK
I don't want to have to approve all registrations, but I want to be able to 
control when people can register (basically just because you have a gmail 
account doesn't mean you can sign in and use the service).  The web app i'm 
creating is being rolled out to specific people in a controlled manner so I 
need this capability.  I was thinking about having some sort of secret 
early access token that if you know lets you register before it is 
completely open to all users.  I liked having the social log in with 
Janrain, but having control over when people can register is more 
important.  Also I do want to have people fill out some additional 
information after the initial Janrain log in.

On Wednesday, March 27, 2013 5:38:35 PM UTC-4, Anthony wrote:

 Are you saying you want to be able to approve the registrations of users 
 (so just logging in via Janrain isn't enough to allow access), or do you 
 simply want to require users to add to their profile when they first log in 
 with Janrain?

 On Wednesday, March 27, 2013 4:08:42 PM UTC-4, DeanK wrote:


 So I want to be able to use Janrain, but I also want to have people have 
 to register.  For my app initially i need to control when registration is 
 open and when it is not, and currently using the examples i've seen, 
 enabling Janrain makes anyone who can authenticate with one of the third 
 party provides able to access the app and add an entry to auth_users.

 This is what did in db.py

 from gluon.contrib.login_methods.rpx_account import use_janrain

 auth.settings.actions_disabled=['change_password','request_reset_password']
 use_janrain(auth, filename='private/janrain.key')

 Once this is done auth works as descrived above, but the register button 
 disappears and /default/user/register/ throws a 404.

 Is there any way to still point to a registration page and make auth only 
 allow users who already exist when logging in via Janrain?  Ideally 
 /register would work and essentially after getting a token from Janrain it 
 would redirect to profile to add additional user info.


 Thanks,
 Dean



-- 

--- 
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: view error tickets in admin when stored in db

2013-03-28 Thread Massimo Di Pierro
Good Point. Please open a ticket about this.

On Wednesday, 27 March 2013 20:04:27 UTC-5, Eric S wrote:


 I'm storing my web2py error tickets in a database. However, the admin 
 interface to the database doesn't show the tickets table. Is this correct? 
 If so, why not show the tickets table?

 Thanks,
 Eric


-- 

--- 
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: datetime diff between tables

2013-03-28 Thread Massimo Di Pierro
Should work but I do not see a checkout.created_on field.

On Wednesday, 27 March 2013 21:16:25 UTC-5, 黄祥 wrote:

 hi,

 is it possible to get datetime diff betwen tables?

 e.g.
 db.define_table('check_in',
 Field('is_booking', 'boolean'),
 Field('booking', 'reference booking'),
 Field('room', 'reference room'),
 Field('guest', 'reference guest'),
 Field('description', 'text'),
 format='%(description)s')

 db.define_table('check_out',
 Field('check_in', 'reference check_in'),
 Field('room', 'reference room'),
 Field('guest', 'reference guest'),
 Field('description', 'text'),
 Field('duration', *compute=lambda r: 
 r['created_on']-r['check_in.created_on']*),
 format='%(guest)s %(room)s')

 when i test, it returns 0:00:00 in duration field.
 any hints or suggestion to handle this?
 thank you very much before


-- 

--- 
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: weird auth error

2013-03-28 Thread Massimo Di Pierro
What Python version? What platform?

On Thursday, 28 March 2013 02:08:39 UTC-5, vince wrote:

 i got this error once in a while, usually restart apache will fix it. it 
 will only happens when using the auth module for login. any idea? the error 
 log is short, any idea on how to trace out the problem?

 i am running web2py 2.4.5-stable+timestamp.2013.03.18.22.46.22


 Traceback (most recent call last):
   File /home/web2py/gluon/main.py, line 555, in wsgibase
 session._try_store_in_db(request, response)
   File /home/web2py/gluon/globals.py, line 732, in _try_store_in_db
 or self._forget or self._unchanged():
   File /home/web2py/gluon/globals.py, line 719, in _unchanged
 session_pickled = cPickle.dumps(dict(self))
   File /usr/lib64/python2.6/copy_reg.py, line 84, in _reduce_ex
 dict = getstate()
 TypeError: 'NoneType' object is not callable



-- 

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




[web2py] Re: Auth with Janrain but still require registration

2013-03-28 Thread Massimo Di Pierro
I have run into similar needs. If we can make a list of specs to handle 
this case which is general enough we can add it to web2py.

On Thursday, 28 March 2013 10:06:25 UTC-5, DeanK wrote:

 I don't want to have to approve all registrations, but I want to be able 
 to control when people can register (basically just because you have a 
 gmail account doesn't mean you can sign in and use the service).  The web 
 app i'm creating is being rolled out to specific people in a controlled 
 manner so I need this capability.  I was thinking about having some sort of 
 secret early access token that if you know lets you register before it is 
 completely open to all users.  I liked having the social log in with 
 Janrain, but having control over when people can register is more 
 important.  Also I do want to have people fill out some additional 
 information after the initial Janrain log in.

 On Wednesday, March 27, 2013 5:38:35 PM UTC-4, Anthony wrote:

 Are you saying you want to be able to approve the registrations of users 
 (so just logging in via Janrain isn't enough to allow access), or do you 
 simply want to require users to add to their profile when they first log in 
 with Janrain?

 On Wednesday, March 27, 2013 4:08:42 PM UTC-4, DeanK wrote:


 So I want to be able to use Janrain, but I also want to have people have 
 to register.  For my app initially i need to control when registration is 
 open and when it is not, and currently using the examples i've seen, 
 enabling Janrain makes anyone who can authenticate with one of the third 
 party provides able to access the app and add an entry to auth_users.

 This is what did in db.py

 from gluon.contrib.login_methods.rpx_account import use_janrain

 auth.settings.actions_disabled=['change_password','request_reset_password']
 use_janrain(auth, filename='private/janrain.key')

 Once this is done auth works as descrived above, but the register button 
 disappears and /default/user/register/ throws a 404.

 Is there any way to still point to a registration page and make auth 
 only allow users who already exist when logging in via Janrain?  Ideally 
 /register would work and essentially after getting a token from Janrain it 
 would redirect to profile to add additional user info.


 Thanks,
 Dean



-- 

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




[web2py] Re: Auth with Janrain but still require registration

2013-03-28 Thread Anthony
On Thursday, March 28, 2013 11:06:25 AM UTC-4, DeanK wrote:

 I don't want to have to approve all registrations, but I want to be able 
 to control when people can register (basically just because you have a 
 gmail account doesn't mean you can sign in and use the service).  The web 
 app i'm creating is being rolled out to specific people in a controlled 
 manner so I need this capability.  I was thinking about having some sort of 
 secret early access token that if you know lets you register before it is 
 completely open to all users.


Sure, that sounds reasonable. Just have the login function check for the 
token in the URL query string (i.e., via request.vars), and if not present, 
redirect or return an appropriate message.
 

 Also I do want to have people fill out some additional information after 
 the initial Janrain log in.


You can define an auth.settings.login_onaccept function that checks to see 
whether the required elements of the profile have been filled out yet, and 
if not, redirect to the profile page.

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

2013-03-28 Thread Umer Farooq
I am new to web2py and i just want to popup a message via fancybox like if 
any filed in the admission form is left empty on submitting i want my 
fancybox to appear on screen displaying the names of the fields that are 
left empty...please help me out with this ..
Thanking you.
Regards..

-- 

--- 
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: After modifying routes.py, GAE still routing to Welcome rather than my app

2013-03-28 Thread Spring
Ok, today I finally solved this problem. the default_application in 
routes.py is case-sensitive. I named my application folder in a upper case 
and caused missing of default app then web2py goes for welcome.

在 2011年11月6日星期日UTC+8下午9时28分27秒,Spring写道:

 Hi there, 

 I'm facing a problem with GAE deployment. GAE still routes to Welcome 
 rather than my app when hitting www.myapp.com. And because I skipped 
 the Welcome app in app.yaml, it gives invalid request. Tried 
 manually to go to www.myapp.com/myapp/default/index, still invalid 
 request. Things seem to be fine when running the app locally with 
 both web2py and GAE launcher. I even tried to give a new version 
 number and re-deploy, but the same happened. 

 Contents of routes.py modified as follows: 

 default_application = 'go2chongqing'# ordinarily set in base 
 routes.py 
 default_controller = 'default'  # ordinarily set in app-specific 
 routes.py 
 default_function = 'index'  # ordinarily set in app-specific 
 routes.py 

 routes_app = ((r'/(?Pappgo2chongqing|welcome|admin|app)\b.*', 
 r'\gapp'), 
   (r'(.*)', r'go2chongqing'), 
   (r'/?(.*)', r'go2chongqing')) 

 routes_in and routes_out remain unchanged. 
 = 
 Can anybody help on this. Thanks in advance. 

 Spring

-- 

--- 
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] Can file/upload field value be retained when form has errors/is not accepted?

2013-03-28 Thread Lamps902
When a form has errors, the value of an upload field is reset upon 
submission. Is there a way to retain this value, or does this pretty much 
have to be handled manually (i.e. by storing the value of the upload field 
or by prompting the user to specify the file again)?

-- 

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




[web2py] Re: web2py, mod_proxy and redirection

2013-03-28 Thread Niphlod



 w2p does not know this - I was using proxypassreverse to make 
 modifications to the
 link on the way back.


Watch out ... proxypassreverse rewrites eventually only headers (i.e. 
redirects), not the urls embedded in your returned webpage.
 

  

 Unless you play a lot with rewritecond or proxypassreverse, the better 
 way is informing web2py in advance that every /whatever/whatever2 url needs 
 to be outputted as /dev/whatever/whatever2 , so you get a consistent 
 behaviour client-side  
 you have to play with your routes.py on the dev instance to make it 
 behave accordingly to what apache is doing.


 Hmm...this results in more differences between the dev
 version and the test version than I had hoped.

 There seem to be quite a few posts in various places
 on how to get w2p working with apache/mod_proxy,
 often via a link such as hostname/web2py - it seems
 that such scenarios should have the same problem.



it would be a lot simpler to map http://host/prod and http://host/dev to 
two instances.
Also because, e.g., if your prod instance mounted on / replies with a 
redirect to /dev/index hoping to catch that request too (e.g. in a dev.py 
controller), in your architecture the latter would be catched by the dev 
instance, so there's no sandboxes around

That's why usually you see in deployment two architectures:
- www.host.com/ and test.host.com/ 
- host.com/appname/ and host.com/appnametest/

but not a combination of both ... it's not impossible, it's just more 
complicated to set up and must watch out for possible problems.

-- 

--- 
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] JSON and COUNT: avoid _extra field?

2013-03-28 Thread Rocco

Hello,

I'm doing some exciting test using jqplot and handsontable with web2py. The 
approach is almost linear: 
   controller with db(...).select(...).as_list() - @service.json - 
$.getJSON

But I've a problem using a count field, that produce a JSON output with a 
_extra field:

Controller:
@service.json
def json_test:
count=db.table.id.count()
dati=db(table.afield==4).select(f_lunghezza,count,groupby(f_lunghezza)).
as_list()
return dict(data=dati)



So if I open controller/json_test.json I get:
{data: [{_extra: {COUNT(*): 2}, table: {f_lunghezza: 9.5}},...}


qjplot has some problem with this kind of json format, so I had to use 
(client side) a js parser...

  ...
  $.each(data, function(index, value) {
 ticks.push(value['table']['f_lunghezza']);
 point.push(value['_extra']['COUNT(*)']);
  });
  ...


I'm looking for a (better) way to get, instead, the following json:
{data: [{table: {f_lunghezza: 9.5,count:2}},...}


There is a way?


Thanks to all


-- 

--- 
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] Is database on GAE overwritten when re-deploy app via GAE launcher?

2013-03-28 Thread Spring
Hello there,

Logically I think the GAE database should not be overwritten when 
re-deploy. Anyone please confirm this? 

Thanks.

Spring

-- 

--- 
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: Can file/upload field value be retained when form has errors/is not accepted?

2013-03-28 Thread Niphlod
It's a bad design choice using a single table with lots of fields plus an 
attachment (if the attachment is large).
I always store attachments in a separate table.

That being said, I don't think that keepvalues will do the trick, cause 
basically keepvalues sends back to the client the contents and prefills the 
field ... throwing the file back to the client doesn't **sound smart**. 
However, it's a chicken-and-egg problem let's say you want to upload a 
picture, you require the picture to have a tag, but the user forgets 
it. in this case, retaining in some way the file can be done...
But let's say you want the file to end with .txt only . the .exe file 
should be discarded at all.
It's up to you to provide logic consistent with the workflow you want for 
your users . 
/me would provide an async upload, store the id on the session and let the 
user play with the remaining fields in a form.
Everyday I'd prune all the attachments received with no remaining fields 
attached. 

On Thursday, March 28, 2013 5:08:24 PM UTC+1, Lamps902 wrote:

 When a form has errors, the value of an upload field is reset upon 
 submission. Is there a way to retain this value, or does this pretty much 
 have to be handled manually (i.e. by storing the value of the upload field 
 or by prompting the user to specify the file again)?


-- 

--- 
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: datetime diff between tables

2013-03-28 Thread 黄祥
i've already define it, and forgot to paste in this email :
db._common_fields.append(auth.signature)

i've already input via database administration to make the date and time 
for check_in.created_on is not on the same day with check_out.created_on 
but the result for duration field is always return 0:00:00.

any idea why this happen?
thank you so much 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: JSON and COUNT: avoid _extra field?

2013-03-28 Thread Niphlod
I don't think there's a way unless you rewrite your dati before returning 
it, or supply your own processor() to the select().

all derived fields of a select are stored into the _extra argument of the 
resulting Rows object with the defaults...


On Thursday, March 28, 2013 5:11:59 PM UTC+1, Rocco wrote:


 Hello,

 I'm doing some exciting test using jqplot and handsontable with web2py. 
 The approach is almost linear: 
controller with db(...).select(...).as_list() - @service.json - 
 $.getJSON

 But I've a problem using a count field, that produce a JSON output with a 
 _extra field:

 Controller:
 @service.json
 def json_test:
 count=db.table.id.count()
 dati=db(table.afield==4).select(f_lunghezza,count,groupby(f_lunghezza
 )).as_list()
 return dict(data=dati)



 So if I open controller/json_test.json I get:
 {data: [{_extra: {COUNT(*): 2}, table: {f_lunghezza: 9.5}},...}


 qjplot has some problem with this kind of json format, so I had to use 
 (client side) a js parser...

   ...
   $.each(data, function(index, value) {
  ticks.push(value['table']['f_lunghezza']);
  point.push(value['_extra']['COUNT(*)']);
   });
   ...


 I'm looking for a (better) way to get, instead, the following json:
 {data: [{table: {f_lunghezza: 9.5,count:2}},...}


 There is a way?


 Thanks to all




-- 

--- 
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] In a grid can I control justification of columns

2013-03-28 Thread Jim S
I want to right justify the data in some of my columns.  I haven't found a 
way to do this with SQLFORM.grid.  Am I missing something?

-Jim

-- 

--- 
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: Can file/upload field value be retained when form has errors/is not accepted?

2013-03-28 Thread Anthony
You can't keep the value that goes in the form on the client side because 
it's a reference to a file path on the client machine and you don't 
actually receive that at the server. You could keep the file itself on the 
server and provide some indication in the form returned to the client that 
the file was retained and need not be uploaded again, but web2py doesn't 
include any automatic functionality for that, so you'd have to code your 
own.

Anthony

On Thursday, March 28, 2013 12:08:24 PM UTC-4, Lamps902 wrote:

 When a form has errors, the value of an upload field is reset upon 
 submission. Is there a way to retain this value, or does this pretty much 
 have to be handled manually (i.e. by storing the value of the upload field 
 or by prompting the user to specify the file again)?


-- 

--- 
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: Can file/upload field value be retained when form has errors/is not accepted?

2013-03-28 Thread Lamps902
Thanks, niphlod and Anthony - some good suggestions and considerations 
mentioned there. niphlod - can you clarify why you recommend using separate 
tables specifically for large files (to prevent users from having to 
re-upload large files when forms aren't accepted?)? The async idea sounds 
pretty good, although it would require a pretty considerable rewrite of a 
lot of the code I have...

On Thursday, March 28, 2013 11:19:06 AM UTC-5, Niphlod wrote:

 It's a bad design choice using a single table with lots of fields plus an 
 attachment (if the attachment is large).
 I always store attachments in a separate table.

 That being said, I don't think that keepvalues will do the trick, cause 
 basically keepvalues sends back to the client the contents and prefills the 
 field ... throwing the file back to the client doesn't **sound smart**. 
 However, it's a chicken-and-egg problem let's say you want to upload a 
 picture, you require the picture to have a tag, but the user forgets 
 it. in this case, retaining in some way the file can be done...
 But let's say you want the file to end with .txt only . the .exe file 
 should be discarded at all.
 It's up to you to provide logic consistent with the workflow you want for 
 your users . 
 /me would provide an async upload, store the id on the session and let the 
 user play with the remaining fields in a form.
 Everyday I'd prune all the attachments received with no remaining fields 
 attached. 

 On Thursday, March 28, 2013 5:08:24 PM UTC+1, Lamps902 wrote:

 When a form has errors, the value of an upload field is reset upon 
 submission. Is there a way to retain this value, or does this pretty much 
 have to be handled manually (i.e. by storing the value of the upload field 
 or by prompting the user to specify the file again)?



-- 

--- 
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: In a grid can I control justification of columns

2013-03-28 Thread Anthony
You could do it via a CSS rule using nth-child. For example, suppose you 
want to right justify the 5th column:

.web2py_grid td:nth-child(5) {text-align: right;}

Note, IE9 doesn't support nth-child, so you'd need to use JS to assign a 
class in that case:

$('.ie .web2py_grid td:nth-child(5)').addClass('right-justify')
...
.right-justify {text-align: right;}

Anthony

On Thursday, March 28, 2013 12:37:18 PM UTC-4, Jim S wrote:

 I want to right justify the data in some of my columns.  I haven't found a 
 way to do this with SQLFORM.grid.  Am I missing something?

 -Jim



-- 

--- 
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: In a grid can I control justification of columns

2013-03-28 Thread Derek
I love nth-child :) As for IE support, try this: http://selectivizr.com/

On Thursday, March 28, 2013 9:48:49 AM UTC-7, Anthony wrote:

 You could do it via a CSS rule using nth-child. For example, suppose you 
 want to right justify the 5th column:

 .web2py_grid td:nth-child(5) {text-align: right;}

 Note, IE9 doesn't support nth-child, so you'd need to use JS to assign a 
 class in that case:

 $('.ie .web2py_grid td:nth-child(5)').addClass('right-justify')
 ...
 .right-justify {text-align: right;}

 Anthony

 On Thursday, March 28, 2013 12:37:18 PM UTC-4, Jim S wrote:

 I want to right justify the data in some of my columns.  I haven't found 
 a way to do this with SQLFORM.grid.  Am I missing something?

 -Jim



-- 

--- 
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: JSON and COUNT: avoid _extra field?

2013-03-28 Thread Derek
Why not do this with client side javascript?

data['table']['count'] = data['count'];

On Thursday, March 28, 2013 9:11:59 AM UTC-7, Rocco wrote:


 Hello,

 I'm doing some exciting test using jqplot and handsontable with web2py. 
 The approach is almost linear: 
controller with db(...).select(...).as_list() - @service.json - 
 $.getJSON

 But I've a problem using a count field, that produce a JSON output with a 
 _extra field:

 Controller:
 @service.json
 def json_test:
 count=db.table.id.count()
 dati=db(table.afield==4).select(f_lunghezza,count,groupby(f_lunghezza
 )).as_list()
 return dict(data=dati)



 So if I open controller/json_test.json I get:
 {data: [{_extra: {COUNT(*): 2}, table: {f_lunghezza: 9.5}},...}


 qjplot has some problem with this kind of json format, so I had to use 
 (client side) a js parser...

   ...
   $.each(data, function(index, value) {
  ticks.push(value['table']['f_lunghezza']);
  point.push(value['_extra']['COUNT(*)']);
   });
   ...


 I'm looking for a (better) way to get, instead, the following json:
 {data: [{table: {f_lunghezza: 9.5,count:2}},...}


 There is a way?


 Thanks to all




-- 

--- 
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] using the IS_URL validator with complex URLs

2013-03-28 Thread Derek
Is there a web2py-dev where I can ask questions such as submitting patches?

On Thursday, March 28, 2013 1:34:01 AM UTC-7, Niphlod wrote:

 send a patch with tests and you'll have it :P

 On Wednesday, March 27, 2013 11:12:02 PM UTC+1, Derek wrote:

 Also looks like the TLDs don't include the internationalized country code 
 top level domains, only the test ones.

 On Wednesday, March 27, 2013 2:57:00 PM UTC-7, Derek wrote:

 It should be checking against RFC 3986, not RFC 2396.

 On Wednesday, March 27, 2013 11:44:08 AM UTC-7, Jonathan Lundell wrote:

 On 27 Mar 2013, at 11:25 AM, Lamps902 dhea...@gmail.com wrote:

 It seems that every once in a while, the IS_URL validator doesn't want 
 to accept a URL that's valid. For example, I believe the ^ character 
 prevents IS_URL from accepting something like 
 http://finance.yahoo.com/q/hp?s=^IXIC+Historical+Priceshttp://finance.yahoo.com/q/hp?s=%5EIXIC+Historical+Prices.
  
 Is there a parameter to permit IS_URL to accept certain special 
 characters, 
 or that makes the validator 'less strict', so that it can accept URLs such 
 as the one above? Thanks.



 IS_URL first checks the URL against RFC 2396, which requires '^' to be 
 escaped. I don't see a way to override it; better to URL-escape your URLs.



-- 

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




[web2py] Re: is there a stable blog app for web2py ?

2013-03-28 Thread Derek
What needs to be updated with instant-press?

On Wednesday, March 27, 2013 8:37:32 PM UTC-7, RunSky ruan wrote:

 I need a blog app for my website.
 Is there a stable blog app for web2py,the instant-press seems last update 
 at 2010,it's not updated for a long time


-- 

--- 
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: In a grid can I control justification of columns

2013-03-28 Thread Jim S
Thanks Anthony.  Just what I wanted.

-Jim


On Thursday, March 28, 2013 11:48:49 AM UTC-5, Anthony wrote:

 You could do it via a CSS rule using nth-child. For example, suppose you 
 want to right justify the 5th column:

 .web2py_grid td:nth-child(5) {text-align: right;}

 Note, IE9 doesn't support nth-child, so you'd need to use JS to assign a 
 class in that case:

 $('.ie .web2py_grid td:nth-child(5)').addClass('right-justify')
 ...
 .right-justify {text-align: right;}

 Anthony

 On Thursday, March 28, 2013 12:37:18 PM UTC-4, Jim S wrote:

 I want to right justify the data in some of my columns.  I haven't found 
 a way to do this with SQLFORM.grid.  Am I missing something?

 -Jim



-- 

--- 
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: automatically generating md5 hash after a file upload

2013-03-28 Thread smoggy
Bump.

Quinta-feira, 28 de Março de 2013 11:32:19 UTC, smoggy escreveu:

 Hello folks,

 So i want to generate a md5 hash of uploaded files. How can this be done ? 
 here is my attempt

 with the following code i get

 AttributeError: 'str' object has no attribute 'retrieve'

 So obviously the row elements are not Field type, and since i'm a python 
 newbie i couldn't figure this. Can anybody tip me on this ?


 def md5_for_file(f):
 ... 
 return md5.digest()

 db.define_table('t_products',
  Field('id','id'),
  Field('f_file_xplatform', type='upload'),
  Field('f_file_xplatform_hash', type='string',label=T('Source File Hash')),
  Field('f_file_xplatform_download_name', 'string', compute=lambda r: 
 download_name(r,XPLATFORM)),
 )

 def download_name(in_row,in_os):
 try:
 tt_row = in_row['f_file_xplatform'].retrieve(nameonly=True)
 print tt_row:   + tt_row
 t_md5 = md5_for_file(tt_row[1])
 in_row['f_file_xplatform_hash']=t_md5
 return 'blabla.'+t_md5
 
 except Exception, e:
 import traceback
 print traceback.format_exc()



-- 

--- 
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] web2py app repository

2013-03-28 Thread Yoel Benitez Fonseca
Is there any public repository where I can publish an application made in 
web2py? ie something web2py specific.

-- 

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




[web2py] Re: Is database on GAE overwritten when re-deploy app via GAE launcher?

2013-03-28 Thread Massimo Di Pierro
it is not overwritten.

On Thursday, 28 March 2013 11:15:05 UTC-5, Spring wrote:

 Hello there,

 Logically I think the GAE database should not be overwritten when 
 re-deploy. Anyone please confirm this? 

 Thanks.

 Spring


-- 

--- 
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: datetime diff between tables

2013-03-28 Thread Massimo Di Pierro
I think you want something like:

Field('duration', 'integer',*compute=lambda r: 
(r['created_on']-r['check_in.created_on']*).days),

or

Field('duration', 'integer', *compute=lambda r: 
(request.now-r['check_in.created_on']*).days),

They should both work but I am more confident about the latter.

On Thursday, 28 March 2013 11:22:02 UTC-5, 黄祥 wrote:

 i've already define it, and forgot to paste in this email :
 db._common_fields.append(auth.signature)

 i've already input via database administration to make the date and time 
 for check_in.created_on is not on the same day with check_out.created_on 
 but the result for duration field is always return 0:00:00.

 any idea why this happen?
 thank you so much 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.




Re: [web2py] using the IS_URL validator with complex URLs

2013-03-28 Thread Massimo Di Pierro
https://groups.google.com/forum/?fromgroups=#!forum/web2py-developers
https://code.google.com/p/web2py/issues/list

On Thursday, 28 March 2013 12:14:48 UTC-5, Derek wrote:

 Is there a web2py-dev where I can ask questions such as submitting patches?

 On Thursday, March 28, 2013 1:34:01 AM UTC-7, Niphlod wrote:

 send a patch with tests and you'll have it :P

 On Wednesday, March 27, 2013 11:12:02 PM UTC+1, Derek wrote:

 Also looks like the TLDs don't include the internationalized country 
 code top level domains, only the test ones.

 On Wednesday, March 27, 2013 2:57:00 PM UTC-7, Derek wrote:

 It should be checking against RFC 3986, not RFC 2396.

 On Wednesday, March 27, 2013 11:44:08 AM UTC-7, Jonathan Lundell wrote:

 On 27 Mar 2013, at 11:25 AM, Lamps902 dhea...@gmail.com wrote:

 It seems that every once in a while, the IS_URL validator doesn't want 
 to accept a URL that's valid. For example, I believe the ^ character 
 prevents IS_URL from accepting something like 
 http://finance.yahoo.com/q/hp?s=^IXIC+Historical+Priceshttp://finance.yahoo.com/q/hp?s=%5EIXIC+Historical+Prices.
  
 Is there a parameter to permit IS_URL to accept certain special 
 characters, 
 or that makes the validator 'less strict', so that it can accept URLs 
 such 
 as the one above? Thanks.



 IS_URL first checks the URL against RFC 2396, which requires '^' to be 
 escaped. I don't see a way to override it; better to URL-escape your URLs.



-- 

--- 
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: automatically generating md5 hash after a file upload

2013-03-28 Thread Massimo Di Pierro
  in_row['f_file_xplatform'].retrieve(nameonly=True)

should be

  db.t_products.f_file_xplatform.retrieve(
in_row['f_file_xplatform'],nameonly=True)

retrieve is a property of the field, not the value.

Anyway, you do not want to recompute the md5 every time the record is 
updaded. Only when a new file is uploaded.

if request.vars.f_file_xplatform:
  db.t_products.f_file_xplatform_download_name.compute=lambda r: 
download_name(r,XPLATFORM)
else:
  db.t_products.f_file_xplatform_download_name.writable = False





On Thursday, 28 March 2013 06:32:19 UTC-5, smoggy wrote:

 Hello folks,

 So i want to generate a md5 hash of uploaded files. How can this be done ? 
 here is my attempt

 with the following code i get

 AttributeError: 'str' object has no attribute 'retrieve'

 So obviously the row elements are not Field type, and since i'm a python 
 newbie i couldn't figure this. Can anybody tip me on this ?


 def md5_for_file(f):
 ... 
 return md5.digest()

 db.define_table('t_products',
  Field('id','id'),
  Field('f_file_xplatform', type='upload'),
  Field('f_file_xplatform_hash', type='string',label=T('Source File Hash')),
  Field('f_file_xplatform_download_name', 'string', compute=lambda r: 
 download_name(r,XPLATFORM)),
 )

 def download_name(in_row,in_os):
 try:
 tt_row = in_row['f_file_xplatform'].retrieve(nameonly=True)
 print tt_row:   + tt_row
 t_md5 = md5_for_file(tt_row[1])
 in_row['f_file_xplatform_hash']=t_md5
 return 'blabla.'+t_md5
 
 except Exception, e:
 import traceback
 print traceback.format_exc()



-- 

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




[web2py] Re: web2py app repository

2013-03-28 Thread Anthony
You can ask Massimo to post it here: http://www.web2py.com/appliances

On Thursday, March 28, 2013 3:11:13 PM UTC-4, Yoel Benitez Fonseca wrote:

 Is there any public repository where I can publish an application made in 
 web2py? ie something web2py specific.


-- 

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




[web2py] Re: web2py app repository

2013-03-28 Thread Massimo Di Pierro
If you post it here it will be added to http://web2py.com/poweredby
If the source is public we can  add it to http://web2py.com/appliances
We need a better place where people can submit code, gets reviewed, taged 
and published.

massimo

On Thursday, 28 March 2013 14:11:13 UTC-5, Yoel Benitez Fonseca wrote:

 Is there any public repository where I can publish an application made in 
 web2py? ie something web2py specific.


-- 

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




[web2py] Re: web2py app repository

2013-03-28 Thread Anthony
Maybe we could add Plugin and Application types to web2pyslices.com and 
post them there. Authors could host the source for each plugin/application 
in its own Github repo and provide a description and link on web2pyslices. 
web2pyslices might then be able to provide an API to access lists of 
plugins and applications (e.g., for automatic installation via admin, etc.).

Anthony

On Thursday, March 28, 2013 3:26:55 PM UTC-4, Massimo Di Pierro wrote:

 If you post it here it will be added to http://web2py.com/poweredby
 If the source is public we can  add it to http://web2py.com/appliances
 We need a better place where people can submit code, gets reviewed, taged 
 and published.

 massimo

 On Thursday, 28 March 2013 14:11:13 UTC-5, Yoel Benitez Fonseca wrote:

 Is there any public repository where I can publish an application made in 
 web2py? ie something web2py specific.



-- 

--- 
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: Can file/upload field value be retained when form has errors/is not accepted?

2013-03-28 Thread Niphlod
cause usually you want to retrieve metadata more than you need the actual 
contents.
It makes you more **sure** when you have to select the entire content vs 
just the metadata attached.
When you'll switch to storing the contents too on the table, that table can 
be partitioned and optimized further (some db don't handle well by default 
large binaries).
Generally, every application now treats the uploads in an async way, so if 
there is any data attached is better to separate roles in different 
tables anyway.
Having them separated leads to a separation of concerns in the first 
place, so your app would be less lenient to, e.g. retrieve the file 
contents and discard it without using it.

On Thursday, March 28, 2013 5:48:35 PM UTC+1, Lamps902 wrote:

 Thanks, niphlod and Anthony - some good suggestions and considerations 
 mentioned there. niphlod - can you clarify why you recommend using separate 
 tables specifically for large files (to prevent users from having to 
 re-upload large files when forms aren't accepted?)? The async idea sounds 
 pretty good, although it would require a pretty considerable rewrite of a 
 lot of the code I have...

 On Thursday, March 28, 2013 11:19:06 AM UTC-5, Niphlod wrote:

 It's a bad design choice using a single table with lots of fields plus an 
 attachment (if the attachment is large).
 I always store attachments in a separate table.

 That being said, I don't think that keepvalues will do the trick, cause 
 basically keepvalues sends back to the client the contents and prefills the 
 field ... throwing the file back to the client doesn't **sound smart**. 
 However, it's a chicken-and-egg problem let's say you want to upload a 
 picture, you require the picture to have a tag, but the user forgets 
 it. in this case, retaining in some way the file can be done...
 But let's say you want the file to end with .txt only . the .exe file 
 should be discarded at all.
 It's up to you to provide logic consistent with the workflow you want for 
 your users . 
 /me would provide an async upload, store the id on the session and let 
 the user play with the remaining fields in a form.
 Everyday I'd prune all the attachments received with no remaining 
 fields attached. 

 On Thursday, March 28, 2013 5:08:24 PM UTC+1, Lamps902 wrote:

 When a form has errors, the value of an upload field is reset upon 
 submission. Is there a way to retain this value, or does this pretty much 
 have to be handled manually (i.e. by storing the value of the upload field 
 or by prompting the user to specify the file again)?



-- 

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




[web2py] Re: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Niphlod
made it better just now ignoring EOL diffs.thanks for the hint.
If you want to reproduce the behaviour, 
git diff --ignore-space-at-eol ..

On Thursday, March 28, 2013 1:36:10 PM UTC+1, Alan Etkin wrote:

 they were edited at least one time for each line, so the diff kinda 
 reports all the removed and all the added lines alltogether.
 That's one of the reasons I made diffbook hunks commit by commit.


 Ok, I will check the diffbook then. 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: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Alan Etkin


 made it better just now ignoring EOL diffs


Niphlod, the diffbook now looks really cool!

An enhancement request: could you add references to line numbers somewhere 
to the next version? 

Thank you

-- 

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




[web2py] Re: Sitemap Plugin or Sitemap Generator

2013-03-28 Thread BlueShadow
So I got a couple minutes and found the problem there was a bakup file of 
my default controler which ended with .1
fixed it by this line: if ctl.endswith(.bak) == False and 
ctl.endswith(.1)== False:

On Tuesday, March 26, 2013 2:50:32 PM UTC+1, BlueShadow wrote:

 Thanks james I did it exactly the other way around I made a list of 
 funktions which are allowed to show ^^.
 It works pretty great except that all static(without an id) funktions show 
 up twice. do you have the same problem?
 I'm sure its easy to fix I will do it once I finished the more pressing 
 matters :)

 On Tuesday, March 26, 2013 7:58:49 AM UTC+1, James Burke wrote:

 Thanks so much for this code, it's really helpful.

 @BlueShadow - I keep my auth functions in a separate controller i.e. 
 admin.py and can simply exclude this function from the list like so:

 if 'admin.py' in ctls: ctls.remove('admin.py')


 If you have functions in default.py that you wish to exclude you can 
 create a list and have these items excluded in the loop, like so:

 exclusions = ['user','unsubscribe']


 for ctl in ctls:
 if ctl.endswith(.bak) == False:
 filename = os.path.join(ctldir,ctl)
 data = open(filename, 'r').read()
 functions = regex_expose.findall(data)
 ctl = ctl[:-3].replace(_, )
 for f in functions:
 if not any(f in s for s in exclusions): # if function is 
 not in exclustions
 sitemap.append(TAG.url(TAG.loc('
 http://www.leandro.inf.br/%s/%s/%s' % (request.application,ctl,f.replace(
 _, )


 Not sure why your deleted function is appearing, the code dynamically 
 generates the sitemap on request.

 I hope that helps.

 -James


 On Monday, March 25, 2013 1:06:14 AM UTC+13, BlueShadow wrote:

 This Sitemap generator is great! But I got a couple questions about 
 it.can you remove all entries which require authorisation?
 I tried it for one of my applications and it shows an entry for a long 
 deleted function(the view has been deleted too). why is that happening?



-- 

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




[web2py] Re: Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-28 Thread Niphlod
you mean both on the original and on the new stacks ?

On Thursday, March 28, 2013 11:00:31 PM UTC+1, Alan Etkin wrote:

 made it better just now ignoring EOL diffs


 Niphlod, the diffbook now looks really cool!

 An enhancement request: could you add references to line numbers somewhere 
 to the next version? 

 Thank you



-- 

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




[web2py] Re: IMG in A tag of SQLFORM `submit_button`?

2013-03-28 Thread Alec Taylor
*bump*


On Tue, Mar 26, 2013 at 6:18 PM, Alec Taylor alec.tayl...@gmail.com wrote:

 {{=SQLFORM.factory(submit_button=XML(SPAN('hello',
 IMG(_src=URL('static', 'img/bg.png')}}

 How do I get this to work?

 Thanks for all suggestions,

 Alec Taylor


-- 

--- 
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] Are there any future plans for native social login in auth?

2013-03-28 Thread HittingSmoke
I know web2py supports Janrain but they charge for what's basically an 
inert layer of code between your app and the login system. It seems silly 
to use it.

It would be nice to see these features baked into auth, where one could put 
in an API key for the most popular social login services (Google/G+, 
Facebook, Twitter) and have native auth support for them.

Is this a possibility for the future or something that's already been 
discussed somewhere?

-- 

--- 
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: Populating jqGrid Tree with JSON

2013-03-28 Thread Nate
Thanks for all the input. I really read the docs. There were heaps of 
mistakes in my code. Now solved and for what its\worth I append the working 
code. Once again Thanks guys!
VIEW
{{extend 'layout.html'}}
 
script type=text/javascript
 jQuery(document).ready(function(){

 $('#treeGrid').jqGrid({

url: {{=URL(r=request,f='call',args=['json','treet'])}},

contentType: application/json; charset=utf-8,
postData:[],
datatype: json,
height: auto,
mType: 'GET',
treeGridModel: 'adjacency',
colNames: [ 'id', 'Prestations', 'neigh'],
colModel: [
{name: 'id', width: 100, key: true, hidden: false},
{name: 'elementName', width: 785, sortable: false},
{name: 'neighbourhood', width: 785, hidden: false}
],
sortname: 'id',
sortorder: asc,
treeGrid: true,
caption: Menu,
ExpandColumn: elementName,
ExpandColClick:true,
jsonReader: { root: row, cell:'', repeatitems: false, userdata: 
userdata},
onSelectRow: function(rowid) {
var row = $(this).getLocalRow(rowid);
// do something with row
alert(Name:  + row.elementName +  Hood:  + row.neighbourhood)
},

autowidth: true
}); 
});
/script

div style=width:180px;
table id=treeGrid/


CONTROLLER

@service.json  
def tree():
import json

response.files.append(http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/redmond/jquery-ui.css;)

response.files.append(http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/css/ui.jqgrid.css;)
response.files.append(http://code.jquery.com/jquery-1.9.1.js;)

response.files.append(http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.js;)

response.files.append(http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/js/i18n/grid.locale-en.js;)

response.files.append(http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/js/jquery.jqGrid.src.js;)

rows = db(db.neighbourhood.id  0).select().as_list()
concat = '{response:['
seq =1
source = dict()
vals = []
for row in rows:   
row['id'] = seq
extra = {'neighbourhood': row.get('elementName'),}
row.update(extra)
print row
vals.append(row)
seq = seq+1
innerrows = db(db.report.parent == row.get('id')).select().as_list()
for innerrow in innerrows:
innerrow.update(extra)
print innerrow
innerrow['id'] = seq
vals.append(innerrow)
seq = seq+1
return dict(row=vals)

On Thursday, March 28, 2013 6:42:56 AM UTC+11, Willoughby wrote:

 Oops - completely missed the 'no javascript' part.
 It would appear it's not loading your jquery/jqgrid scripts.  Are you 
 loading them in layout.html?
 See this:

 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_to_install

 On Monday, March 25, 2013 6:51:10 PM UTC-4, Nate wrote:

 Nothing in the console. Firebug reports

 No Javascript on this pageIf script tags have a type attribute, it 
 should equal text/javascript or application/javascript. Also scripts 
 must be parsable (syntactically correct).


 On Monday, March 25, 2013 11:15:31 PM UTC+11, Willoughby wrote:

 Do you get any errors in the console? That's the first place I usually 
 look...

 On Sunday, March 24, 2013 8:42:45 PM UTC-4, Nate wrote:

 Hi

  I have a controller sending JSON to my view. I cannot get the data 
 into the TreeGrid. The Json is coming down correctly (I placed it manually 
 and it works). Running this code places the JSON on the webpage. 
 Controller 
 and View below.

 Help appreciated.
 Regards
 Nate

 CONTROLLER
 @service.json
 def get_report():
 import json
 
 rows = db(db.neighbourhood.id  0).select().as_list()
 concat = '{response:['
 seq =1
 for row in rows:
 row['id'] = seq
 concat = concat + json.dumps(row)+,
 seq = seq+1
 innerrows = db(db.report.parent == 
 row.get('id')).select().as_list()
 for innerrow in innerrows:
 innerrow['id'] = seq
 concat = concat + json.dumps(innerrow) + ,
 seq = seq+1
 concat = concat.strip( ',' )
 concat = concat + ']},grid;'
 return concat


 VIEW
 {{extend 'layout.html'}}
 script type=text/javascript
  jQuery(document).ready(function(){

  jQuery.getJSON({{=URL(r=request,f='call',args=['json','get_report'])}},
 function(msg){
jQuery.each(msg, function(){ 
 topicjson = this;

 $('#treeGrid').jqGrid({
 datastr: topicjson,
 datatype: json,
 height: auto,
 mType: 'GET',
 treeGridModel: 'adjacency',
 colNames: [/*id,*/Items,url],
 colModel: [
 {name: elementName, width:250, resizable: false},
 {name: url,width:1,hidden:true}
 ],
 treeGrid: true,
 caption: Neighbourhood,
 ExpandColumn: name,
 ExpandColClick:true,
 

[web2py] Re: Is database on GAE overwritten when re-deploy app via GAE launcher?

2013-03-28 Thread Spring
Thanks for the kind reply, Massimo.

在 2013年3月29日星期五UTC+8上午3时12分13秒,Massimo Di Pierro写道:

 it is not overwritten.

 On Thursday, 28 March 2013 11:15:05 UTC-5, Spring wrote:

 Hello there,

 Logically I think the GAE database should not be overwritten when 
 re-deploy. Anyone please confirm this? 

 Thanks.

 Spring



-- 

--- 
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: Are there any future plans for native social login in auth?

2013-03-28 Thread Niphlod
there's an open feature-request on google code to include sanction in 
web2py.

On Friday, March 29, 2013 12:56:53 AM UTC+1, HittingSmoke wrote:

 I know web2py supports Janrain but they charge for what's basically an 
 inert layer of code between your app and the login system. It seems silly 
 to use it.

 It would be nice to see these features baked into auth, where one could 
 put in an API key for the most popular social login services (Google/G+, 
 Facebook, Twitter) and have native auth support for them.

 Is this a possibility for the future or something that's already been 
 discussed somewhere?


-- 

--- 
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] StopForumSpam: new plugin available

2013-03-28 Thread Niphlod
Here https://github.com/niphlod/w2p_SFS_plugin

Ultra-alpha-Release ... expect bugs, api changes and some other 
intricacies

PS: if someone wants to chime in to figure out an algorithm to calculate 
confidence (0-100) based on frequency and last_seen I'm happy to hear its 
thoughs

Ideas welcome.

-- 

--- 
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: IMG in A tag of SQLFORM `submit_button`?

2013-03-28 Thread Anthony
The value of submit_button goes in the value attribute of the submit 
input element, so it can only be text, not more HTML elements. If you 
need an alternative to a standard submit button with a text label, you can 
do:

SQLFORM.factory(..., buttons=[list of one or more button elements])

The standard submit button will not appear, and instead the button(s) 
specified in the list will be placed inside a DIV().

I think there are a few ways to get images in submit buttons, including 
input type='image' src='[image url]' name='submit' / or specifying a 
background image for a standard input type='submit' ... / button. Google 
it.

Anthony

On Tuesday, March 26, 2013 3:18:32 AM UTC-4, Alec Taylor wrote:

 {{=SQLFORM.factory(submit_button=XML(SPAN('hello', 
 IMG(_src=URL('static', 'img/bg.png')}} 

 How do I get this to work? 

 Thanks for all suggestions, 

 Alec Taylor 


-- 

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




[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-28 Thread Sarbjit singh
Thanks 黄祥,

Can you please share the code.

-Sarbjit

On Tuesday, March 26, 2013 5:10:20 AM UTC+5:30, 黄祥 wrote:

 it can, yesterday i've already tested it, i'll share the code when i'm at 
 the office.

-- 

--- 
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] [FYI] Pyodel is now a plugin

2013-03-28 Thread Spring
Hello Alan,

I tried pyodel and faced with the same issue of google login requirement. I 
signed in with google account but redirect to the Sign in with your google 
accounthttps://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttp://pyodel.appspot.com/ltmpl=gmshdf=ChILEgZhaG5hbWUaBlB5b2RlbAwSAmFoIhSZY5By1PCj3EjZf9NrJ3GmqIjN_SgBMhR51VTpu4b1JO0uu3RNmEpSXxw4bA.
 
page, cannot go any further.

In fact my own app is facing the same problem. When at the page of Sign in 
with your google 
accounthttps://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttp://pyodel.appspot.com/ltmpl=gmshdf=ChILEgZhaG5hbWUaBlB5b2RlbAwSAmFoIhSZY5By1PCj3EjZf9NrJ3GmqIjN_SgBMhR51VTpu4b1JO0uu3RNmEpSXxw4bA.
 
only signing with the app creator's google account can pass it. Somehow I 
assume it's because the logging is set to login as app administrator by 
some unknown means. I hope you or someone may come up with a solution.

Regards,
Spring

在 2012年10月18日星期四UTC+8下午11时45分15秒,Alan Etkin写道:

  El jueves, 18 de octubre de 2012 12:29:17 UTC-3, Bill Thayer 
 escribió:Just tried it again. Logged in with my email and password 
  then 
  it took me to a blank page with one line on top that says to sign in 
 with google password.

 I must admit this is some kind of app issue. However, I have created a 
 fake user and authenticated without a Google account. I'll have to check 
 how GAE handles app users so I can fix this somehow.



-- 

--- 
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] Using an external lib - Twython

2013-03-28 Thread Nate
Hi

I've used pip to install Twython and it works as advertised.

In web2py
I get an error
type 'exceptions.ImportError' cannot import name Twython

I have installed by hand into the local modules folder and get the same 
response

In desperation I tried 

twython = local_import('twython')

Same error.

I wonder if that capital T (Twython) has anything to do with it?

Help much appreciated.

n8

-- 

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