[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-29 Thread Anthony
Can you show your code?

On Friday, August 29, 2014 12:54:48 AM UTC-4, Sarbjit wrote:
>
> I have an application having the layout as :-
>
> INDEX controller generates a view which have some drop-down and calls 
> another controller RESULTS :
>
> Snippet :
>  action={{=URL('default','results')}} >
>
> Now the RESULTS controller creates a grid and populates the view 
> corresponding to RESULT controller.
>
> PROBLEM :-
>
> When I view/edit any entry of GRID, then on using the browser back button, 
> I get the following message :-
>
> Document Expired (Firefox)
> Need to conform form resubmissions (ERR_CACHE_MISS) -- Chrome
>
> In the RESULTS controller, I just query request.vars for variables and 
> store them in session and later on clear the session once the GRID is 
> populated.
>
> I don't see this problem if I use the BACK button provided by the GRID 
> itself (URL contained a signature - Is it causing it to work?)
>
> Can any one please suggest on how to address this problem. This is very 
> annoying problem.
>
> Thanks in advance
> Sarbjit
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-29 Thread Sarbjit
Hi Anthony,

Thanks for response.

It would be difficult for me to share the exact code (my company specific 
data and lot of extra code etc)

However, I am providing code snippets of the main portions that I feel are 
causing this problem  and work flow (i have changed the variable names):-

Please let me know, if you still require the exact code, then I'll try to 
reproduce it in a small app that can be shared as such.

*INDEX :*

index function from controllers returns options to be populated in select 
html column. It uses ajax callbacks to dynamically populate the select 
field.

{{extend 'layout.html'}}


...

...




Once the options are selected the results function is called :-

def results(): 
if (request.vars.testval and session.var1 and session.var2) or 
(len(request.vars) == 0):
try:
del session.var1
del session.var2
except Exception : pass
if (request.vars.var1) and (not session.var1):
   session.var1 = request.vars.var1
if request.vars.var2 and not session.var2:
   session.var2 = request.vars.var2

Then the session data is checked and a grid is created. Results view just 
displays the grid data.

Now from the grid data, when I select any row and uses browser back button, 
I get this problem.

Thanks
Sarbjit


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-29 Thread Sarbjit
More Updates :

I tried debugging it using Eclipse and I observed that whenever the 
document expires, breakpoint is not hit. (results function).

Also I observed that once I use the Back button from within the grid field, 
it starts working from the browser also but only for current selection 
(from index controller).

If I change the selection from index and comes back to results - Then i 
face the same problem again - have to use back button from grid once, then 
browser button works fine for other grid entries.

Now any pointers on where to proceed?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Both auth.login() and auth.register() on the same page, prevents password validation

2014-08-29 Thread Mark Li
Ahh yes that would explain it. Thanks for the tip, Anthony!

Also, submitted the issue: 
https://code.google.com/p/web2py/issues/detail?id=1971

On Thursday, August 28, 2014 3:36:17 PM UTC-7, Anthony wrote:
>
> Looks like a bug. The login() method does the following:
>
> passfield = settings.password_field
> try:
> table_user[passfield].requires[-1].min_length = 0
> except:
> pass
>
> It sets the minimum length for the password field to 0 but doesn't restore 
> it. Please submit a Google Code issue.
>
> In the meantime, you can just define the register form first, or after 
> defining the login form, do:
>
> db.auth_user.password.requires[-1].min_length = auth.settings.
> password_min_length
>
> Anthony
>
> On Thursday, August 28, 2014 4:17:33 PM UTC-4, Mark Li wrote:
>>
>> I currently have both auth.login() and auth.register() forms on the same 
>> page. A simplified version of my code below:
>>
>> def page():
>> login_form = auth.login()
>> register_form = auth.register()
>>
>> return dict(login_form=login_form, register_form=register_form)
>>
>> If you go to the page with both forms, and submit the register form with 
>> errors (such as completely blank), the password field is NOT validated for 
>> the submitted register form!
>>
>> I have a test example here:
>> http://tedlee.pythonanywhere.com/welcome/default/formtest
>>
>> If you define auth.register() first, instead of auth.login(), then this 
>> problem does not appear for register, but there might be problems with 
>> auth.login() (I have not tested this yet).
>>
>> Is this a bug, or is there a proper way to include both login and 
>> register forms on the same page, while having correct server-side 
>> validation?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] How to put both login and register forms on one page...

2014-08-29 Thread Mark Li
The details of this problem are explained more thoroughly here: 
https://groups.google.com/forum/#!topic/web2py/13gozLyE3Eo


On Thursday, August 28, 2014 1:11:47 PM UTC-7, Mark Li wrote:
>
> There seems to be a problem with this implementation
>
> For example, if you have
> def page():
> login_form = auth.login()
> register_form = auth.register()
>
> return dict(login_form=login_form, register_form=register_form)
>
> If you go to the page with both forms, and submit the register form with 
> errors (such as completely blank), the password field is NOT validated for 
> the submitted register form!
>
> I have a test example here:
> http://tedlee.pythonanywhere.com/welcome/default/formtest
>
> If you define auth.register() first, instead of auth.login(), then this 
> problem does not appear for register, but there might be problems with 
> auth.login() (I have not tested this yet).
>
> On Wednesday, January 23, 2013 7:45:34 PM UTC-8, rochacbruno wrote:
>>
>> return dict(register=auth.register() , login=auth.login()) 
>>
>> {{=register}} 
>>
>> {{=login}} 
>> Em 23/01/2013 20:39, "sasogeek"  escreveu:
>>
>>> how do I put the login and register forms on one page... so that a user 
>>> is logged in if they click the login button (if they've entered correct 
>>> email and password) and are signed up if they click the register button 
>>> with form data for a new account? 
>>>
>>> -- 
>>>  
>>>  
>>>  
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-29 Thread Anthony
To make this easier to debug, it would be helpful if you could attach a 
minimal app that reproduces the behavior.

On Friday, August 29, 2014 11:32:20 AM UTC-4, Sarbjit wrote:
>
> More Updates :
>
> I tried debugging it using Eclipse and I observed that whenever the 
> document expires, breakpoint is not hit. (results function).
>
> Also I observed that once I use the Back button from within the grid 
> field, it starts working from the browser also but only for current 
> selection (from index controller).
>
> If I change the selection from index and comes back to results - Then i 
> face the same problem again - have to use back button from grid once, then 
> browser button works fine for other grid entries.
>
> Now any pointers on where to proceed?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: import_from_csv_file and unique

2014-08-29 Thread Derek
I think it should, but I'm assuming that's not how it is in practice.

On Thursday, August 28, 2014 11:55:26 PM UTC-7, lyn2py wrote:
>
> Thanks Derek. If the "uuid" field were specified, shouldn't the specified 
> field be used, the way a uuid field is used, to de-duplicate records?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] two forms submitted into the same cotroller

2014-08-29 Thread Andrey K
Dear list,

I have two related questions:

1. Basically I have one view (C) which contains two forms A and B. The 
dynamic form A is created by controller A and added by web2py_component 
(Ajax call). The static  form B is created by controller B and added via 
helper LOAD. I want to submit both forms into controller A of form A. How 
to do it ?

2. Also I want to know how I can have one controller that will dynamically 
create 
 two forms via web2py_component (Ajax call) and place both of them into the 
two separate div's of the same view. I want then that the data of both 
forms are submitted simultaneously into the same controller and processed 
there?

I managed to generate two forms in one controller but I cannot separate 
them into different div's on the same view.

I would be happy if you could advise me on this,
Andrey

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: (Very) Slow raw SQL queries

2014-08-29 Thread Mehmet A.
Hello Derek. Yesterday I replied to the discussion but my post never made 
it to the public, don't know why.
Newline characters are indeed in the queries. They're there because I used 
triple-quotes to create query string. I also tried removing them, didn't 
help.
And I can't reproduce the slowness on the console. This makes me wonder 
about a potential bug.
I tried following cases:

...
> raw_data = dbs.executesql(query, as_dict=True) #Takes 30 seconds to return 
> a result
> from gluon.debug import dbg
> dbg.set_trace()
> raw_data = dbs.executesql(query, as_dict=True) #Takes <1 second to return 
> a result


or

...
> from gluon.debug import dbg
> dbg.set_trace()
> raw_data = dbs.executesql(query, as_dict=True) #Takes <1 second to return 
> a result


On Monday, August 25, 2014 6:53:04 PM UTC+2, Derek wrote:
>
> so here is his code...
> SELECT TIMESTAMPDIFF(...) AS 'duration',
>  TIMESTAMPDIFF(...)
> - INTERVAL 1 HOUR, TIMESTAMP(...)
> + INTERVAL CAST(...) AS 'timediff',
>  ris.ODATE as 'date',
>  CONCAT(...) as 'service'
> FROM ... AS ris
> JOIN ... as sd on ris = sd
> WHERE ris != '-00-00 00:00:00'
>   and ris != '-00-00 00:00:00'
>   and ris >= '2010-8-15'
>   and ris <= '2014-8-22'
>
> so the timing for that is:  32.046038147
>
> as far as what are the differences, well, web2py does open a transaction 
> and then close the transaction...
>
> On Monday, August 25, 2014 9:24:41 AM UTC-7, Cliff Kachinske wrote:
>>
>> Why is '\n', the newline character, sprinkled throughout your query?
>>
>> See what happens if you get rid of them.
>>
>> On Monday, August 25, 2014 4:54:53 AM UTC-4, Mehmet A. wrote:
>>>
>>> Hi,
>>> db.executesql() takes 30 seconds to return a result while page-loading, 
>>> despite the fact that same query takes 0.5-1 second if I try it on MySQL 
>>> console or web2py debug console or web2py shell.
>>>
>>> [4] dbs._timings
 [('SELECT 1;', 0.01632424926758),
  ('SET FOREIGN_KEY_CHECKS=1;', 0.00348501586914),
  ("SET sql_mode='NO_BACKSLASH_ESCAPES';", 0.00800013542175293),
  ("SELECT TIMESTAMPDIFF(...) AS 'duration',\n
  TIMESTAMPDIFF(...)\n
 - INTERVAL 1 HOUR, TIMESTAMP(...)\n
 + INTERVAL CAST(...) AS 'timediff',\n
  ris.ODATE as 'date',\n
  CONCAT(...) as 'service'\n
 FROM ... AS ris\n
 JOIN ... as sd on ris = sd\n
 WHERE ris != '-00-00 00:00:00'\n
   and ris != '-00-00 00:00:00'\n
   and ris >= '2010-8-15'\n
   and ris <= '2014-8-22'", 32.046038147),
>>>
>>>  ("SELECT TIMESTAMPDIFF(...) AS 'duration',\n
  TIMESTAMPDIFF(...)\n
 - INTERVAL 1 HOUR, TIMESTAMP(...)\n
 + INTERVAL CAST(...) AS 'timediff',\n
  ris.ODATE as 'date',\n
  CONCAT(...) as 'service'\n
 FROM ... AS ris\n
 JOIN ... as sd on ris = sd\n
 WHERE ris != '-00-00 00:00:00'\n
   and ris != '-00-00 00:00:00'\n
   and ris >= '2010-8-15'\n
   and ris <= '2014-8-22'", 0.6069998741149902)]
>>>
>>>
>>> The query that took 32 seconds was executed with the page request. The 
>>> controller was falling to the debug console after db.executesql(), so the 
>>> second query which took 0.6 second was executed by me on the same session.
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] ajax login, wrong password redirects to wrong page

2014-08-29 Thread Maciej S
Some time ago I posted question on stackoverflow, and I still don't have a 
solution. I haven't found solution on the google mail list.

Could someone help me:
http://stackoverflow.com/questions/21433391/web2py-ajax-login-wrong-password-redirects-to-wrong-page

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] web2py RESTful service - POST and PUT

2014-08-29 Thread Kristina Nikolic
Hi!

I'm making Android application which connects to my simple web2py 
application. I'm successful at making GET, POST, PUT and DELETE calls for 
table that I have made. However, when I try to make POST or PUT call for 
auth_user table, nothing happens.

This is my code for RESTful (I found it here: 
http://www.web2pyslices.com/slice/show/1533/restful-api-with-web2py)  :

@request.restful()
def api():
response.view = 'generic.'+request.extension
def GET(*args,**vars):
patterns = [ 
"/mytable[mytable]",
"/mytable[mytable]/{mytable.id}",
"/user[auth_user]/{auth_user.id}",
"/user[auth_user]",
]
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
return db[table_name].validate_and_insert(**vars)
def PUT(table_name,record_id,**vars):
return db(db[table_name]._id==record_id).update(**vars)
def DELETE(table_name,record_id):
return db(db[table_name]._id==record_id).delete()
return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)

Can somebody tell me why is that happening? Is it possible that I cannot 
make POST  and PUT calls for auth_user table?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: Requirements per application

2014-08-29 Thread Kuba Kozłowicz
Well actually you are right. I just thought about web2py as a big hub of 
applications, where each application shares the very same interpreter, 
which I do not like because of aforementioned reasons.

 In django I'd simply create another instance to solve that problem and 
include a URL to it somewhere. 

As to web2py technically I could do the same, but it would require creating 
"second" hub of applications, which for me is a bit contrary to the idea of 
having one central point of management ( like an intranet or smth similar ).

But, yeah I think I wanted too much, every framework works this way, 
however I think this feature ( of having separate interpreters for separate 
apps ) would be nice to have.

W dniu poniedziałek, 25 sierpnia 2014 19:08:26 UTC+2 użytkownik Derek 
napisał:
>
> That's not possible for django or any other python webapp. where did you 
> get this idea?
>
> On Monday, August 25, 2014 1:12:12 AM UTC-7, Kuba Kozłowicz wrote:
>>
>> Yea, well with different instances you can do it, but I asked if that is 
>> possible for one instance, which contains multiple apps.
>>
>> So it's impossible.
>>
>> W dniu niedziela, 24 sierpnia 2014 12:13:57 UTC+2 użytkownik Michele 
>> Comitini napisał:
>>>
>>> I think you just need to make some python virtualenvs for each set of 
>>> modules and then run *different* instances of web2py.  You can do that 
>>> easily and in many different ways.
>>>
>>>
>>> 2014-08-22 12:21 GMT+02:00 Kuba Kozłowicz :
>>>
 I know I can put app-specific modules into application//modules. 
 This is not what I meant.

 I mean I want a different python interpreter per each app - is that 
 possible?
 Because one of them will have installed library in version X and the 
 other one will have installed the same libary, but in version Y.

 Imagine I have one app running some processes using let's say Twisted 
 2.0.

 Then after a year Twisted 3.0 is published and I want to now to develop 
 new apps using the newest version.

 If version 3.0 is not backwards compatibile then I will have to either 
 rewrite old stuff to newest version, or keep using old version.

 This is the problem I want to solve.

 W dniu środa, 20 sierpnia 2014 20:15:06 UTC+2 użytkownik Massimo Di 
 Pierro napisał:

> Yes. you put them in application//modules/ and then each app will 
> import from there.
> Some modules break when you do this. If it happens bring it up here 
> and we can tell you how to fox them.
>
> On Monday, 18 August 2014 03:45:34 UTC-5, Kuba Kozłowicz wrote:
>>
>> I would like to know if it is possible to install different set of 
>> modules for each application separately.
>>
>> I have a Web2py instance, which consists of serveral applications and 
>> the number of applications will grow. Some of those apps use library X 
>> in 
>> version Y. The apps, that will be deployed in the future will be using 
>> the 
>> very same library X but in newer version. My question is if it is 
>> possible 
>> to install the same module in different version for separate apps?
>>
>> Or is one forced to either use old version with all apps or update 
>> all of them if one wanted to upadate version of the library X?
>>
>  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: (Very) Slow raw SQL queries

2014-08-29 Thread Mehmet A.
It's in the query, it's because of I used triple-quotes while constructing 
the query. I tried removing them, didn't help. I can't even reproduce it on 
the console.

...
> raw_data = dbs.executesql(query, as_dict=True) #Takes more than 30 seconds
> from gluon.debug import dbg
> dbg.set_trace()
> #Debug starts here
> raw_data = dbs.executesql(query, as_dict=True) #Takes less than 1s


or

...
> from gluon.debug import dbg
> dbg.set_trace()
> #Debug starts here
> raw_data = dbs.executesql(query, as_dict=True) #Again, it takes less than 
> 1s



On Monday, August 25, 2014 6:48:45 PM UTC+2, Derek wrote:
>
> I believe the timings did that, it's not in the query.
>
> On Monday, August 25, 2014 9:24:41 AM UTC-7, Cliff Kachinske wrote:
>>
>> Why is '\n', the newline character, sprinkled throughout your query?
>>
>> See what happens if you get rid of them.
>>
>> On Monday, August 25, 2014 4:54:53 AM UTC-4, Mehmet A. wrote:
>>>
>>> Hi,
>>> db.executesql() takes 30 seconds to return a result while page-loading, 
>>> despite the fact that same query takes 0.5-1 second if I try it on MySQL 
>>> console or web2py debug console or web2py shell.
>>>
>>> [4] dbs._timings
 [('SELECT 1;', 0.01632424926758),
  ('SET FOREIGN_KEY_CHECKS=1;', 0.00348501586914),
  ("SET sql_mode='NO_BACKSLASH_ESCAPES';", 0.00800013542175293),
  ("SELECT TIMESTAMPDIFF(...) AS 'duration',\n
  TIMESTAMPDIFF(...)\n
 - INTERVAL 1 HOUR, TIMESTAMP(...)\n
 + INTERVAL CAST(...) AS 'timediff',\n
  ris.ODATE as 'date',\n
  CONCAT(...) as 'service'\n
 FROM ... AS ris\n
 JOIN ... as sd on ris = sd\n
 WHERE ris != '-00-00 00:00:00'\n
   and ris != '-00-00 00:00:00'\n
   and ris >= '2010-8-15'\n
   and ris <= '2014-8-22'", 32.046038147),
>>>
>>>  ("SELECT TIMESTAMPDIFF(...) AS 'duration',\n
  TIMESTAMPDIFF(...)\n
 - INTERVAL 1 HOUR, TIMESTAMP(...)\n
 + INTERVAL CAST(...) AS 'timediff',\n
  ris.ODATE as 'date',\n
  CONCAT(...) as 'service'\n
 FROM ... AS ris\n
 JOIN ... as sd on ris = sd\n
 WHERE ris != '-00-00 00:00:00'\n
   and ris != '-00-00 00:00:00'\n
   and ris >= '2010-8-15'\n
   and ris <= '2014-8-22'", 0.6069998741149902)]
>>>
>>>
>>> The query that took 32 seconds was executed with the page request. The 
>>> controller was falling to the debug console after db.executesql(), so the 
>>> second query which took 0.6 second was executed by me on the same session.
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] How can I prevent a user from pressing the browser's back button?

2014-08-29 Thread Fotis Gioulekas
Hello to everybody,

I have built a quiz that randomlycreates questions.
Each time a user submits it's answer, the app redirects to another question.
When the user does not want to continue to another question it presses a 
button "exit quiz" and the app redirects to another url.
When the user presses the browser's back button, it can return back to the 
quiz. 
How can I prevent this?
Is there a solution that either closes the browser's tab or redirects to a 
default html page when the user presses the back broswer's button or 

My app does not requires user registratrion and login.

Thank you in advance,
Fotios

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Combobox vs. Dropdown box

2014-08-29 Thread Tim Price
Why does the documentation refer to comboboxes when in fact they are just 
run-of-the-mill dropdown boxes? This is confusing.

For that matter, are there any suggestions out there for *actual* dropdown 
boxes, i.e. editable dropdown boxes -- the kind that combine the 
functionalities of an input field and a dropdown box?

Thanks

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Error in wsgi/apache

2014-08-29 Thread Nail Hassairi
I am using postgres database with web2py on Linode. I have tried simulating 
the same volume of requests on 
a barebones hello world web2py app and the error does not show up so I am 
suspecting it has to do with the database
or the interworkings between web2py and the database?

On Tuesday, August 12, 2014 11:09:56 AM UTC-7, Nail Hassairi wrote:
>
> I am getting errors like this:
>
> [Mon Aug 11 16:34:23 2014] [error] [client 54.200.16.41] mod_wsgi 
> (pid=23422): Exception occurred processing WSGI script 
> '/home/econ/utility/web2py/wsgihandler.py'.
> [Mon Aug 11 16:34:23 2014] [error] [client 54.200.16.41] IOError: failed 
> to write data
> [Mon Aug 11 16:37:44 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:37:49 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:37:55 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:00 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:05 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:10 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:15 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:21 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:26 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:31 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:36 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:41 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:46 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:52 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:38:57 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:39:02 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:39:07 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:39:12 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:39:18 2014] [error] [client 54.200.16.41] Script timed out 
> before returning headers: wsgihandler.py
> [Mon Aug 11 16:39:23 2014] [error] [client 54.200.16.41] mod_wsgi 
> (pid=23422): Exception occurred processing WSGI script 
> '/home/econ/utility/web2py/wsgihandler.py'.
> [Mon Aug 11 16:39:23 2014] [error] [client 54.200.16.41] IOError: failed 
> to write data
>
> When this happens apache freezes and the access.log reports HTTP 408 
> errors:
>
> 193.174.89.19 - - [10/Aug/2014:07:38:03 +] "-" 408 0
>
> The first time this happened the server was online and it was taken 
> offline. Later on I was trying to simulate traffic
> for short periods of time and this error does seem to get bigger with the 
> volume of the traffic but sometimes
> even large volume of traffic does not trigger it and sometimes smaller 
> amount of traffic triggers it.
>
> This seems to be demanding of the CPU resources but memory seems to be 
> largely idle (top):
>
> PID  USER  PR  NI  VIRT  RES  SHR S   %CPU %MEMTIME+  COMMAND 
> 
> 
> 2967econ20   0  142m   83m   16m S  60 2.1 
>  41:34.55 apache2   
> 
>   
> 3308postgres  20   0  50036   35m   32m S 20  0.9 
> 10:01.85 postgres
>
> $ free -m
>
> >  total   used   free sharedbuffers cached
> Mem:  4002953   3049  0 31662
> -/+ buffers/cache:258   3743
> Swap:  511  0511
>
> But given that the server has 4 cores it appears unlikely to me that this 
> would simply be a hardware resource constraint.
>
>
> 
> The above picture shows the proportion of the HTTP 408 Timeout Error of 
> all HTTP requests.
> Do you know what might be causi

[web2py] Re: Scheduler task finishes but row not marked COMPLETED

2014-08-29 Thread Stephen Weiss

I tried using strace to see what the process was doing and this is what I 
found.
Not sure it's of any help or not?

[root@centos-63 ~]# !ps
ps -ef | grep web
root  8228  7923  0 13:21 pts/500:00:03 python web2py.py -K APITool2
root  8425  8228  0 13:58 pts/500:00:00 python web2py.py -K APITool2
root  8482  8185  0 13:58 pts/000:00:00 grep web
[root@centos-63 ~]# strace -p 8425
Process 8425 attached - interrupt to quit
futex(0x20a65d0, FUTEX_WAIT_PRIVATE, 0, NULL   
^C 
Process 8425 detached
[root@centos-63 ~]# 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: share datebases with different application

2014-08-29 Thread eric cuver
this is my client wants it that way. it's stupid but I can not do anything. 
no it is not authentication is just exchanges of information between the 
two applications do you have idea ?
Le lundi 25 août 2014 19:29:25 UTC+2, Derek a écrit :
>
> Sure, why not. But the question is, why? If it's authentication, there is 
> a central authentication service that you can use.
>
> On Monday, August 25, 2014 4:17:44 AM UTC-7, eric cuver wrote:
>>
>> Hi,
>>
>> I have 2 applications (AppA, AppB). Each application has a database 
>> (AppA.db, AppB.db). 
>> There is a table in AppA (AppA.table), which should be used in AppB and 
>> There is a table in AppB (AppB.table),
>> which should be used in AppA
>>
>> it's possible with web2py ?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Custom HTML form and process using web2py

2014-08-29 Thread Bernard Nongpoh
Example : I have a  form called Login 



  
  Login
  
  

  

  
Email address

  
  
Password

  

  Login
  Register




  

I want to Process using web2py


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: On a Smartgrid form is it possible to set create to False for parent nodes but true for child nodes

2014-08-29 Thread Carlos Alba
Inspired on Jim's post, this works for me(o delete or create at parent 
table level):

currentTable = request.args(1)
if currentTable:
deletable= create= True
else:
deletable= create= False
grid = SQLFORM.smartgrid(...
create=create,deletable=deletable,
...
  )

On Monday, March 11, 2013 2:36:12 PM UTC-5, Michael Hall wrote:
>
> My tables are:
> t_contact (the parent)
> t_paypal
> t_paypal_fails
> t_paypal_contacted
>
> All the child tables refer to the parents ID.
>
> I have a controller that looks like this:
>
> @auth.requires_login()
> def paypal_manage():
> form = 
> SQLFORM.smartgrid(db.t_contact,linked_tables=['t_paypal','t_paypal_fails', 
> 't_paypal_contacted'], onupdate=auth.archive,searchable=dict(parent=True, 
> child=True,))
> return locals()
>
> Using smartgrid I wish to achieve  a grid that allows the user to search 
> by contact but not actually add contacts via that controller. Once they 
> have found the contact they should be able to create records for the 
> contacts's linked tables.
>
> I was thinking that it would be something like this:
> create=dict(parent=True, child=False)
>
> Is this possible? If so what is the correct syntax?
>
> Many thanks in advance.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] How can i create a custom registration??

2014-08-29 Thread Leonardo Silvano
Hi, i'm new to web2py, i'm experimenting some things, I made a new 
controller called user to handle login, reset password, profile update and 
password changing, this way i'm not using default controller, what i'm 
trying to do now is to be able to create new users that can log in using 
web2py auth, is there any way to use the auth.register() to do this?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Deleting a record in built-in wiki with versioning causes error

2014-08-29 Thread Ed Tate

I am able to cause an error trying to delete a wiki page for the built-in 
wiki if I turn versioning on. 
This example causes an error in web2py 2.9.5:

Starting with a new application, name it "wiki_test" and do the following:

# in db.py, add
auth.wiki(resolve=False)
auth.enable_record_versioning(db)

# in default.py replace index with
def index(): return auth.wiki()

# in default.py comment our authorization for table access (this simplified 
testing)
#@auth.requires_signature()


Once completed use the app to...
  1) Create a new user & login
  2) Create a new wiki page which includes a tag
  3) Delete the wiki_page using the url for the table deletion function 
- for example 
http://127.0.0.1:8000/wiki_test/default/data/delete/wiki_page/1

You should get a ticket for the following error: 
  'NoneType' object has no attribute 
'id' 

with the following traceback:

> Traceback (most recent call last):
> File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 220, in 
> restricted
> File 
> *"C:/__PA/other/web2py/applications/wiki_test/controllers/default.py"* 
> , 
> line 80, in 
> File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 385, in <
> lambda>
> File 
> *"C:/__PA/other/web2py/applications/wiki_test/controllers/default.py"* 
> , 
> line 78, in data
> return dict(form=crud())
> File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 3813, in 
> __call__
> File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 4047, in 
> delete
> File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8982, in 
> __delitem__
> File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10534, in 
> delete
> File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10534, in <
> genexpr>
> File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8822, in <
> lambda>
> File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10550, in 
> update
> File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 5440, in 
> update_tags_update
> AttributeError: 'NoneType' object has no attribute 'id'


If I repeat this, but comment out "auth.enable_record_versioning(db)" in 
db.py, the error if eliminated. However, I'd like to use version tracking 
with the wiki, so this is not a solution. 


Is there a way to use versioning and delete wiki records without causing an 
error?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] How to do references, and dropdowns?

2014-08-29 Thread Gary Cowell
Hello

I have the following in models:

db.define_table('senders',
Field('sender','string',length=80,label="Sender"))

db.define_table('documents',

Field('description','text',requires=IS_LENGTH(256,1),label="Description"),
Field('header_date','date',label="Header Date"),
Field('received_date','date',label="Received Date"),
Field("sent_by",db.senders,label="Sent By",requires=IS_IN_DB(db, 
'senders.sender')))



So I want some 'senders', with a description 'sender' and some 'documents'. 
Each 'documents' has one 'senders', a 'senders' has many 'documents'.

I added the requres=IS_IN_DB to enable a SQLFORM to provide a drop down 
list of SENDERS when I create a new document. This works but ...

We get this:

 FOREIGN KEY constraint failed

When we create the DOCUMENT, even though it specifies a SENDER from the 
dropdown

Is this because the drop down is senders.sender but the RI constraint is on 
senders.id ?

I'm not a fan of surrogate keys, I must say. Traditionally I would have 
defined SENDERS as SENDER_CODE, SENDER_NAME and given a meaningful code, 
such as 

NWAT, Northumbrian Water

instead of

1,Northumbrian Water

which is what I have now.

Anyway, what have I messed up in my model/form, please? I can't see how to 
change it to fix this

Form is built with this controller code:

@auth.requires_login()
def newdocument():

form = SQLFORM(db.documents).process()

if form.accepted:
response.flash = 'new record inserted'

dochead = {'documents.description':'Description', 
'documents.header_date':'Header Date', 'documents.received_date':'Received 
Date', 'documents.sent_by':'Sender',}

# and get a list of all documents
records = SQLTABLE(db().select(db.documents.ALL), truncate=80, headers 
= dochead )

return dict(form=form, records=records)

View:

{{extend 'layout.html'}}
Documents
{{=form}}
Current Documents
{{=records}}

Thanks for any assistance

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] CSV Import - Headers with Spaces

2014-08-29 Thread Angelo Mellos
Hello,

I have a csv that comes from another program that I then import into a 
web2py database. It has header names with spaces and that seems to prevent 
it from being imported. I can make a macro in excel to format it before it 
gets imported, but ideally that wouldn't be necessary mainly because then 
the other clerks will have to know and remember to do that step.

I thought I could maybe stick something in the def import_csv like this:

def import_csv(table, file):
import csv
csvData = csv.reader(open(file))
isHeader = True
for row in csvData:
if isHeader:
isHeader = False
headerRow = row
for i in range(len(headerRow)):
# replace spaces w/ underscores in column headers
headerRow[i] = headerRow[i].replace(' ', '_')
table.import_from_csv_file(file)

But that doesn't work, and I really don't know if I'm on the right track.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Total newbie, advice on storing scans

2014-08-29 Thread Gary Cowell


On Thursday, 21 August 2014 16:34:46 UTC+1, Michael Beller wrote:
>
> Web2py has an 'upload' field type that helps you manage file uploads. 
>  "Upload" is a little bit of a misnomer because you can select the file 
> path to store the file (or an existing path) and the blob is not stored in 
> the database.
>
> You can read more here:
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=upload#SQLFORM-and-uploads
>
> There are several good Bootstrap and Jquery plugins that you can use to 
> view a "lightbox" type of layout of your scanned images with the ability to 
> zoom on an image rather than download and then open the file which I think 
> would be best for your archival type of solution.  Here's just one example:
> http://www.bootply.com/71401
>
> There are many discussions on the web2py upload feature in this forum and 
> some 'slices' that you may find helpful such as:
> http://www.web2pyslices.com/slice/show/1504/manual-uploads
>
> Hope that helps.
>
> Mike
>
>
>

It did help, thanks. The thing is, I don't want to 'upload' my scans, there 
is an acquire button on my page that triggers the scanner to scan the 
current document on the flatbed. Currently this is only held in memory in 
my scanner class, I just wanted it stored so that web2py can present it in 
a lightbox kind of way (good example there).

I'll keep looking through those examples, thank you 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Insert a record after user has been verified

2014-08-29 Thread asumal
Hello everyone,

My situation. I would like to approve every user that signs up with my 
site. I understand that I should set the following to True (in db.py):

 auth.settings.registration_requires_approval = True


After I approve the user, I would like to insert a value into the database. 
I tried the following (in default.py):

auth.settings.register_onaccept.append(lambda form: __add_company(form))
>
 

def __add_company(form):
> print 'user.id', auth.user_id
> dbs.company.insert(name = form.vars.Company, created_by = auth.user_id)


However, this inserts the value when the user signs up and before I can 
verify. Also, the auth.user_id is None because the user is not signed in. 
Is there another way to do this? Is there a function that runs after an 
update to the auth.user_id. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Auth form custom errors

2014-08-29 Thread Bernard Nongpoh
Hello Web2py , I'm new to web2py can you please help me in this problem
1. I want to use angularJS +Bootstrap+ Web2py
2. I want to separate the web2py from the view ie. angularJS and Bootstrap
3. All Views Should be handle by angularJS + Bootstrap kind of RESTFUL 
SERVICES
4. This is the first problem I encounter

I want to display custom error messages when user is fail to login 
here is my view

{{extend 'custom-layout.html'}}
{{block angular-script}}

{{end}}


  
  Login
  
  

  
 
  
  {{if form.errors:}}
  
  ×Close
  {{=form.errors}} 


{{pass}}
Email address


  
  
Password

  






   
  
  Register




  


Controllers 
def index():
if auth.is_logged_in():
redirect(URL('user','index'))
form = auth.login()
  
return dict(form=form)
Enter code here...





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Google Cloud SQL and web2py_filesystem table.

2014-08-29 Thread Mikael Brandt
Thanks for the idea, it will do for now!

Den tisdagen den 26:e augusti 2014 kl. 15:20:26 UTC+2 skrev Leonel Câmara:
>
> I guess a quick solution for you, could be to monkeypatch 
> isProgrammingError to something like this
>
> def isProgrammingError(self, exception):
> return exception.__class__.__name__ == 'ProgrammingError'
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: multiple DAL

2014-08-29 Thread eric cuver
can you give me example please ?

Le lundi 25 août 2014 21:08:47 UTC+2, Niphlod a écrit :
>
> or you can just use migrate=False and leave it be.
>
> On Monday, August 25, 2014 7:49:32 PM UTC+2, Leonel Câmara wrote:
>>
>> Ohh then you also need to pass the "folder" argument to your DAL as the 
>> sqlite file will not be in your application's database folder but in the 
>> other app's folder.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] How to delete built in wiki page that has a tag and uses versioning?

2014-08-29 Thread Ed Tate
If I use the builtin wiki feature and turn on record versioning, I get 
error when I delete a wiki page which has a tag. Is there a way around this 
issue?

Recipe to duplicate the error in web2py 2.9.5:

1) Create a new application. Call it 'test_wiki'.
2) Make the following modifications:

add the following two lines to the end of db.py:
auth.wiki(resolve=False)
auth.enable_record_versioning(db)



replace the index function in default.py with:
def index(): return auth.wiki()


To simplify testing, comment out @auth.requires_signature()  on the data 
function.

#@auth.requires_signature()
def data():
...

3) Open the application and register as a new user: 
http://127.0.0.1:8000/test_wiki/default/user/register 
4) Create a new page: 
http://127.0.0.1:8000/test_wiki/default/index/_create/index , then hit 
create from slug
5) Add a tag
6) Hit submit
7) Delete the wiki page using 
http://127.0.0.1:8000/test_wiki/default/data/delete/wiki_page/1 . This 
fails. It results in an internal error and a ticket. The error is " 'NoneType' object has no attribute 'id'" with 
a traceback of:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

Traceback (most recent call last):
  File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 220, in 
restricted
  File "D:/_PA/web2py_win/web2py/applications/test_wiki/controllers/default.py" 
, 
line 78, in 
  File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 385, in 

  File "D:/_PA/web2py_win/web2py/applications/test_wiki/controllers/default.py" 
, 
line 76, in data
return dict(form=crud())
  File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 3813, in 
__call__
  File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 4047, in delete
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8982, in 
__delitem__
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10534, in delete
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10534, in 

  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8822, in 
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 10550, in update
  File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 5440, in 
update_tags_update
AttributeError







-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: share datebases with different application

2014-08-29 Thread Massimo Di Pierro
AppA can define

dbA = DAL('connect to a.')
dbB = DAL('connect to b.')

and AppB can do the the same

dbA = DAL('connect to a.')
dbB = DAL('connect to b.')

each model (in A and B) need to define the table that they need. You should 
also disable migrations because you do not want two apps to mess with your 
tables.

On Monday, 25 August 2014 06:17:44 UTC-5, eric cuver wrote:
>
> Hi,
>
> I have 2 applications (AppA, AppB). Each application has a database 
> (AppA.db, AppB.db). 
> There is a table in AppA (AppA.table), which should be used in AppB and 
> There is a table in AppB (AppB.table),
> which should be used in AppA
>
> it's possible with web2py ?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: Requirements per application

2014-08-29 Thread Massimo Di Pierro
I am not sure I fully understand. 

Both in web2py and Django you create multiple instances of the server 
(either by replicating the code or by simply starting it twice) and you can 
have them serve different applications. If you do you have them see 
different virtualenvs. In web2py you also have the option of running 
multiple applications under the same instance and this is what people 
usually prefer. In this case there is only only one process and by 
definition one virtualenv.

You cannot have different virtualenvs for for applications that run under 
the same process because virtualenv wraps the process. The point here is 
that python sys.path is not thread safe in the sense that you cannot have 
different ones in different threads. You cannot have two functions running 
concurrently change sys.path without breaking the interpreter.

Massimo

On Tuesday, 26 August 2014 03:24:21 UTC-5, Kuba Kozłowicz wrote:
>
> Well actually you are right. I just thought about web2py as a big hub of 
> applications, where each application shares the very same interpreter, 
> which I do not like because of aforementioned reasons.
>
>  In django I'd simply create another instance to solve that problem and 
> include a URL to it somewhere. 
>
> As to web2py technically I could do the same, but it would require 
> creating "second" hub of applications, which for me is a bit contrary to 
> the idea of having one central point of management ( like an intranet or 
> smth similar ).
>
> But, yeah I think I wanted too much, every framework works this way, 
> however I think this feature ( of having separate interpreters for separate 
> apps ) would be nice to have.
>
> W dniu poniedziałek, 25 sierpnia 2014 19:08:26 UTC+2 użytkownik Derek 
> napisał:
>>
>> That's not possible for django or any other python webapp. where did you 
>> get this idea?
>>
>> On Monday, August 25, 2014 1:12:12 AM UTC-7, Kuba Kozłowicz wrote:
>>>
>>> Yea, well with different instances you can do it, but I asked if that is 
>>> possible for one instance, which contains multiple apps.
>>>
>>> So it's impossible.
>>>
>>> W dniu niedziela, 24 sierpnia 2014 12:13:57 UTC+2 użytkownik Michele 
>>> Comitini napisał:

 I think you just need to make some python virtualenvs for each set of 
 modules and then run *different* instances of web2py.  You can do that 
 easily and in many different ways.


 2014-08-22 12:21 GMT+02:00 Kuba Kozłowicz :

> I know I can put app-specific modules into application//modules. 
> This is not what I meant.
>
> I mean I want a different python interpreter per each app - is that 
> possible?
> Because one of them will have installed library in version X and the 
> other one will have installed the same libary, but in version Y.
>
> Imagine I have one app running some processes using let's say Twisted 
> 2.0.
>
> Then after a year Twisted 3.0 is published and I want to now to 
> develop new apps using the newest version.
>
> If version 3.0 is not backwards compatibile then I will have to either 
> rewrite old stuff to newest version, or keep using old version.
>
> This is the problem I want to solve.
>
> W dniu środa, 20 sierpnia 2014 20:15:06 UTC+2 użytkownik Massimo Di 
> Pierro napisał:
>
>> Yes. you put them in application//modules/ and then each app 
>> will import from there.
>> Some modules break when you do this. If it happens bring it up here 
>> and we can tell you how to fox them.
>>
>> On Monday, 18 August 2014 03:45:34 UTC-5, Kuba Kozłowicz wrote:
>>>
>>> I would like to know if it is possible to install different set of 
>>> modules for each application separately.
>>>
>>> I have a Web2py instance, which consists of serveral applications 
>>> and the number of applications will grow. Some of those apps use 
>>> library X 
>>> in version Y. The apps, that will be deployed in the future will be 
>>> using 
>>> the very same library X but in newer version. My question is if it is 
>>> possible to install the same module in different version for separate 
>>> apps?
>>>
>>> Or is one forced to either use old version with all apps or update 
>>> all of them if one wanted to upadate version of the library X?
>>>
>>  -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> 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+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Docu

[web2py] Re: CSV Import - Headers with Spaces

2014-08-29 Thread Massimo Di Pierro
import csv
rows = [row for row in csv.reader(open(file))]
rows[0] = map(lambda h:h.replace(' ','_'), rows[0])


On Tuesday, 26 August 2014 09:07:46 UTC-5, Angelo Mellos wrote:
>
> Hello,
>
> I have a csv that comes from another program that I then import into a 
> web2py database. It has header names with spaces and that seems to prevent 
> it from being imported. I can make a macro in excel to format it before it 
> gets imported, but ideally that wouldn't be necessary mainly because then 
> the other clerks will have to know and remember to do that step.
>
> I thought I could maybe stick something in the def import_csv like this:
>
> def import_csv(table, file):
> import csv
> csvData = csv.reader(open(file))
> isHeader = True
> for row in csvData:
> if isHeader:
> isHeader = False
> headerRow = row
> for i in range(len(headerRow)):
> # replace spaces w/ underscores in column headers
> headerRow[i] = headerRow[i].replace(' ', '_')
> table.import_from_csv_file(file)
>
> But that doesn't work, and I really don't know if I'm on the right track.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Can't get web2py working with GAE locally

2014-08-29 Thread Massimo Di Pierro
But now we simply do 

web2py.py -G GAE

and everything is taken care for you you automatically.

On Wednesday, 27 August 2014 08:45:43 UTC-5, Richard Penman wrote:
>
> Would be worth mentioning this in the book.
>
>
> On Saturday, January 4, 2014 3:25:17 AM UTC+1, Massimo Di Pierro wrote:
>>
>> It is in handlers/gaehandler.py 
>> There reason we moved is that we do now want to pollute the main folder 
>> and we do now want to overwrote any changes you may have to make to it upon 
>> upgrade. You have to 
>>
>> cp handlers/gaehandler.py ./
>>
>>
>> On Thursday, 2 January 2014 20:33:35 UTC-6, Jaime Sempere wrote:
>>>
>>> Hi everyone, this is driving me mad.
>>>
>>> I used web2py and GAE one year ago and I liked a lot, fast and easy to 
>>> work with gae. Now that I wanted to start another app, I have download GAE 
>>> and Web2Py again (for having last releases and starting in a clean&new 
>>> folder).
>>>
>>> So, first change that I see is that when I run dev_appserver from GAE 
>>> forces to use python 2.7. My first guess then, is that I need to change 
>>> gaehandler in app.yaml and leave the code like this:
>>>
>>> application: myapp
>>> version: 1
>>> api_version: 1
>>>
>>>
>>>   #script: gaehandler.py # CGI
>>>   script: gaehandler.wsgiapp# WSGI (Python 2.7 only)
>>>   secure: optional
>>>
>>> But when I do a http://localhost:8080/
>>>
>>> I obtain this error in console:
>>>
>>> ERROR2014-01-03 02:25:39,821 wsgi.py:262] 
>>> Traceback (most recent call last):
>>>   File 
>>> "/home/mrkite/DesarrolloATUBETV/google_appengine/google/appengine/runtime/wsgi.py",
>>>  
>>> line 239, in Handle
>>> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>>>   File 
>>> "/home/mrkite/DesarrolloATUBETV/google_appengine/google/appengine/runtime/wsgi.py",
>>>  
>>> line 298, in _LoadHandler
>>> handler, path, err = LoadObject(self._handler)
>>>   File 
>>> "/home/mrkite/DesarrolloATUBETV/google_appengine/google/appengine/runtime/wsgi.py",
>>>  
>>> line 84, in LoadObject
>>> obj = __import__(path[0])
>>> ImportError: No module named gaehandler
>>> INFO 2014-01-03 02:25:39,834 module.py:617] default: "GET / 
>>> HTTP/1.1" 500 -
>>> INFO 2014-01-03 02:25:40,208 module.py:617] default: "GET 
>>> /favicon.ico HTTP/1.1" 304 -
>>>
>>>
>>>
>>>
>>> And of course I can't see any html returned. Why gaehandler is missing?
>>>
>>> I can reach localhost:8001/myapp   (web2py server)
>>> But not   localhost:8080  (gae)
>>>
>>> And second question: for running my appGAE locally do I need to have 
>>> running web2py server? I used to have both running, but now I have seen 
>>> that I need to change default port 8000 to other (i.e. 8001), because gae 
>>> is using 8000 and 8080.
>>>
>>>
>>> Any help would be very appreciated. Thank you 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: ajax login, wrong password redirects to wrong page

2014-08-29 Thread Massimo Di Pierro
Please open a ticket. Which python version?

On Thursday, 28 August 2014 08:19:42 UTC-5, Maciej S wrote:
>
> Some time ago I posted question on stackoverflow, and I still don't have a 
> solution. I haven't found solution on the google mail list.
>
> Could someone help me:
>
> http://stackoverflow.com/questions/21433391/web2py-ajax-login-wrong-password-redirects-to-wrong-page
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: How can i create a custom registration??

2014-08-29 Thread Massimo Di Pierro
You do not need to create your own controller for that you can access

/app/appadmin/manage/auth

On Thursday, 28 August 2014 16:09:20 UTC-5, Leonardo Silvano wrote:
>
> Hi, i'm new to web2py, i'm experimenting some things, I made a new 
> controller called user to handle login, reset password, profile update and 
> password changing, this way i'm not using default controller, what i'm 
> trying to do now is to be able to create new users that can log in using 
> web2py auth, is there any way to use the auth.register() to do this?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: two forms submitted into the same cotroller

2014-08-29 Thread Massimo Di Pierro
Something is wrong here. Can you explain at higher level what are you 
trying to achieve?

On Friday, 29 August 2014 16:10:59 UTC-5, Andrey K wrote:
>
> Dear list,
>
> I have two related questions:
>
> 1. Basically I have one view (C) which contains two forms A and B. The 
> dynamic form A is created by controller A and added by web2py_component 
> (Ajax call). The static  form B is created by controller B and added via 
> helper LOAD. I want to submit both forms into controller A of form A. How 
> to do it ?
>
> 2. Also I want to know how I can have one controller that will dynamically 
> create 
>  two forms via web2py_component (Ajax call) and place both of them into the 
> two separate div's of the same view. I want then that the data of both 
> forms are submitted simultaneously into the same controller and processed 
> there?
>
> I managed to generate two forms in one controller but I cannot separate 
> them into different div's on the same view.
>
> I would be happy if you could advise me on this,
> Andrey
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] GAE NDB is there a problem with using belongs on an id field?

2014-08-29 Thread Russ King

I am struggling to use belongs on GAE+NDB it appears that:

quests = 
db(db.question.level.belongs([1])).select(db.question.id,db.question.level) 
 is valid  however

quests = db(db.question.id.belongs([1])).select(db.question.id, 
db.question.level) generates an error along the lines of 

 type object 'question' has no attribute 
'__key__'

is this because the key field is different from the other fields and is 
there some sort of workaround to retrieve a set of records from a list of 
keys or am I missing something

Regards
Russ

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] example in book not validate form

2014-08-29 Thread Federico Ferraro
EXAMPLE:

http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-in-HTML

Mi model:
db.define_table('solicitud',Field('ape', requires=IS_NOT_EMPTY()))

Mi controler:

def solicitud():
form = SQLFORM(db.solicitud)
if form.accepts(request,session=None, formname=None):
response.flash = 'Acceptado'
elif form.errors:
   response.flash = 'Errores %s --- %s  %s' %
(form.errors,form.vars,request.vars)
else:
response.flash = 'Llene el formulario'
return dict()

Mi view:

{{extend 'layout.html'}}
{{= T('Nueva Solicitud')}} 

Apellido: 



Never passes the validation and always throws errors. Anyone know what I'm
doing wrong?



-- 
--
Federico Ferraro
Usuario Linux : 482533.
--

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Philosophical help with REST

2014-08-29 Thread Joe Barnhart
I'm using the restful pattern with my web2py app today, and I find it to be 
a very powerful concept.  I think I'm having a conceptual difficulty, tho, 
with the different levels at which web2py helpers operate to make my life 
easier.

In one specific case, I have a swimmer record that, along with other 
fields, contains the id of the club the swimmer belongs to (id_club).  When 
obtaining records via REST, I would prefer to see the default 
representation for the club, a 6-character string unique to that club.  But 
the restful helpers in web2py return only the simplest underlying data, 
with no processing of "represents". 

Should I add fields to the table to save the club name and id separately? 
 That seems like a recipe for inconsistent tables.  Should I use some sort 
of virtual or computed Field to add the name of the club to the table? 
 (Would virtuals even work with restful apis?)  Or should I just return the 
id and write the javascript needed to call another rest api to get the name 
of the club from its id?

This is a philosophical question because I have dozens of tables and views 
I need to do.  I need to work *with* the philosophy of web2py and not swim 
against it.  So what would be the path with lowest resistance to having a 
restful api that returns the table row of a swimmer with id's like 
"id_club" translated into more human-readable versions?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-08-29 Thread Massimo Di Pierro
This should work, can you please open a ticket? Mind that it is pointless 
to select columns/fields on GAE since it always fetches them all.

On Friday, 29 August 2014 18:37:07 UTC-5, Russ King wrote:
>
>
> I am struggling to use belongs on GAE+NDB it appears that:
>
> quests = 
> db(db.question.level.belongs([1])).select(db.question.id,db.question.level) 
>  is valid  however
>
> quests = db(db.question.id.belongs([1])).select(db.question.id, 
> db.question.level) generates an error along the lines of 
>
>  type object 'question' has no attribute 
> '__key__'
>
> is this because the key field is different from the other fields and is 
> there some sort of workaround to retrieve a set of records from a list of 
> keys or am I missing something
>
> Regards
> Russ
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: example in book not validate form

2014-08-29 Thread Massimo Di Pierro
form.accepts(request,session=None, formname=None):

should be

form.accepts(request.get_vars,session=None, formname=None):

else it is interpreted as

form.accepts(request.post_vars,session=None, formname=None):

but you have a GET form.

On Friday, 29 August 2014 20:34:49 UTC-5, Federico Ferraro wrote:
>
> EXAMPLE:
>
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-in-HTML
>
> Mi model: 
> db.define_table('solicitud',Field('ape', requires=IS_NOT_EMPTY()))
>
> Mi controler:
>
> def solicitud():
> form = SQLFORM(db.solicitud)
> if form.accepts(request,session=None, formname=None):
> response.flash = 'Acceptado'
> elif form.errors:
>response.flash = 'Errores %s --- %s  %s' % 
> (form.errors,form.vars,request.vars)
> else:
> response.flash = 'Llene el formulario'
> return dict()
>
> Mi view:
>
> {{extend 'layout.html'}}
> {{= T('Nueva Solicitud')}} 
> 
> Apellido: 
> 
> 
>
> Never passes the validation and always throws errors. Anyone know what I'm 
> doing wrong?
>
>
>
> -- 
> --
> Federico Ferraro
> Usuario Linux : 482533.
> -- 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-29 Thread Sarbjit
Hi Anthony,

I am able to reproduce this problem in a small app (tested on windows - 
2.9.5).

*MODEL:*

db.define_table('Category',
Field('Name'),
Field('SubCategoryName'))
 
# Insert test data 
 
if db(db.Category.id>0).count() == 0:
db.Category.insert(Name='PC',SubCategoryName='Intel')
db.Category.insert(Name='PC',SubCategoryName='AMD')
db.Category.insert(Name='SmartPhone',SubCategoryName='Apple')
db.Category.insert(Name='SmartPhone',SubCategoryName='HTC')
db.Category.insert(Name='SmartPhone',SubCategoryName='Google')

*CONTROLLER:*

def index():
response.flash = T("Welcome to web2py!")
return dict(message=T('Hello World'))

def results():
if (request.vars.testval and session.var1):
try:
del session.var1
except Exception : pass
if (request.vars.var1) and (not session.var1):
   session.var1 = request.vars.var1
grid = {}
if session.var1:
query = (db.Category.Name==session.var1)
grid = SQLFORM.grid(query=query)
return dict(grid=grid)

*VIEWS:*

*results.html*

{{extend 'layout.html'}}
{{=grid}}

*index.html*

{{extend 'layout.html'}}


PC
Smart Phone





*Steps to reproduce the problem :-*

1. Select any value from the drop down and hit submit button.
2. Select any GRID row and click on View
3. Use Browser Back button -> Document will expire, you have to refresh to 
get the results back (Tried on Chrome/Firefox)
4. Repeat Step2
5. Now instead of using Browser back button, use GRID embedded back button.
6. Now repeating step 2-3 won't cause any problem (document won't expire) 
until the new selection is made from the selection drop down.

Please suggest something to resolve this problem. 

Thanks
Sarbjit

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: bootstrap 3 - if you care help test trunk now

2014-08-29 Thread Joe Barnhart
I think there may be a change in operation for "contains()" in the DAL.  

With the last release, I can use an empty string as an argument to 
contains, and it will return all values (i.e. the empty string matches 
all).  In the trunk version the empty string matches nothing.  I don't know 
which is more "correct" but it does mean I need to change my code in 
numerous places to accommodate the change in usage.

-- Joe


On Saturday, August 9, 2014 12:13:38 AM UTC-7, Massimo Di Pierro wrote:
>
> Bootstrap 3 is in trunk now. Please help us test it.
> Also help us test that existing apps are not broken.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] How can I prevent a user from pressing the browser's back button?

2014-08-29 Thread Marin Pranjić
You can't. This is something you should take care of on server side.
Use session to store user's state, or store it in DB.


On Tue, Aug 26, 2014 at 11:36 PM, Fotis Gioulekas 
wrote:

> Hello to everybody,
>
> I have built a quiz that randomlycreates questions.
> Each time a user submits it's answer, the app redirects to another
> question.
> When the user does not want to continue to another question it presses a
> button "exit quiz" and the app redirects to another url.
> When the user presses the browser's back button, it can return back to the
> quiz.
> How can I prevent this?
> Is there a solution that either closes the browser's tab or redirects to a
> default html page when the user presses the back broswer's button or
>
> My app does not requires user registratrion and login.
>
> Thank you in advance,
> Fotios
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.