[web2py] Re: Web2py - Front-end performance optimization tutorial

2015-09-17 Thread pang

>
> I also noticed in the source code that puting main.css.gz in the same 
> directory as main.css will automatically serve the gzipped version with the 
> correct headers : that's pretty sweet.
> I didn't know about it before though (it isn't documented), so I built my 
> own gzip management.
>
> It is documented here:

http://web2py.com/books/default/chapter/29/13/deployment-recipes#Compress-static-files
 


I found the above script (and the corresponding configuration in the nginx 
config file) reduced my load time A LOT (didn't measure).

Thanks for having this kind of discussion.

-- 
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: Why do i have to submit the form twice in order to work?

2015-09-17 Thread Alfonso Serra

Thanks Annet, ill definitely will try, 

I was trying to get away without having to write formstyles, since i need 
control on the html output and it was a single post at a time.

I thought SQLFORM would be enough. but it isnt, ive hacked form.custom.end 
so it renders the right id and formname for each row but i still have to 
submit twice to fix the tokens. I understand why this happens. the 
controller expects the same form declared to be submitted, but with a table 
you cant know what record/form is to be modified beforehand.

So ye, grid or smartgrid it is.

Btw: im looking for an advanced course or teacher, cant find any on google. 
If you do teach please contact me privately.
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: Adding class='hidden' creates an element style='display: none'

2015-09-17 Thread Stuart Rolinson
Perhaps breaks was a little strong, I should say it conflict with 
Bootstrap's .hidden class and causes problems with javascript being used to 
show and hide sections.

Thanks,
Stuart

On Wednesday, September 16, 2015 at 10:02:23 AM UTC-7, Anthony wrote:
>
> What Bootstrap functionality is broken by this?
>
> On Wednesday, September 16, 2015 at 9:42:55 AM UTC-4, Stuart Rolinson 
> wrote:
>>
>> When I create an item directly in the html form with a class ='hidden' 
>> for use with bootstrap, web2py appears to be rendering an additional 
>> element style "display:none" which stops bootstrap functionality working 
>> correctly.
>>
>> Raw HTML:
>>
>> 
>>   > for='slctCounty'>Select County
>>   
>>  
>>
>> Rendered HTML:
>>
>> 
>>   > for="slctCounty">Select County
>>   
>> 
>>
>> Is this correct behaviour?  I don't think it should be doing this.
>>
>> Thanks,
>> Stuart
>>
>

-- 
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: Why do i have to submit the form twice in order to work?

2015-09-17 Thread Alfonso Serra
And this does work, which is very bad.

def example2():

rows = db(db.agencias).select()

#create as many forms as rows
forms = dict()
for row in rows:
forms[row.id] = SQLFORM(db.agencias, row.id).process()

fields = forms.itervalues().next().fields

if request.post_vars:
id = request.post_vars.id
if isinstance(id, list): id = id[-1] #get the id from the hidden 
field, not the record

form = forms[int(id)] #get the corresponding form

if form.accepted:
print "all good"
elif form.errors:
print "not good"
else:
print "welcome"

rows = db(db.agencias).select()
return locals()

This is bad since you have to query the db twice, and create as many 
SQLFORM instances as records, also bad.

Smartgrid and grid doesnt look like they fit my needs, ill keep reading 
about them but they expose several routes to edit a record when im trying 
to update them in a single view.

If i could use a dummy SQLFORM that passes a db.table validation of a 
random incoming post would be enough. ill keep trying. 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: Adding class='hidden' creates an element style='display: none'

2015-09-17 Thread Stuart Rolinson
That got it , Thanks.

On Wednesday, September 16, 2015 at 10:02:23 AM UTC-7, Anthony wrote:
>
> What Bootstrap functionality is broken by this?
>
> On Wednesday, September 16, 2015 at 9:42:55 AM UTC-4, Stuart Rolinson 
> wrote:
>>
>> When I create an item directly in the html form with a class ='hidden' 
>> for use with bootstrap, web2py appears to be rendering an additional 
>> element style "display:none" which stops bootstrap functionality working 
>> correctly.
>>
>> Raw HTML:
>>
>> 
>>   > for='slctCounty'>Select County
>>   
>>  
>>
>> Rendered HTML:
>>
>> 
>>   > for="slctCounty">Select County
>>   
>> 
>>
>> Is this correct behaviour?  I don't think it should be doing this.
>>
>> Thanks,
>> Stuart
>>
>

-- 
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: Adding class='hidden' creates an element style='display: none'

2015-09-17 Thread Stuart Rolinson
That got it , Thanks.

On Wednesday, September 16, 2015 at 6:42:55 AM UTC-7, Stuart Rolinson wrote:
>
> When I create an item directly in the html form with a class ='hidden' for 
> use with bootstrap, web2py appears to be rendering an additional element 
> style "display:none" which stops bootstrap functionality working correctly.
>
> Raw HTML:
>
> 
>for='slctCounty'>Select County
>   
>  
>
> Rendered HTML:
>
> 
>for="slctCounty">Select County
>   
> 
>
> Is this correct behaviour?  I don't think it should be doing this.
>
> Thanks,
> Stuart
>

-- 
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: Initialize vars

2015-09-17 Thread Manuele Pesenti
Il 16/09/15 19:41, lenin.marti...@metamaxzone.com ha scritto:
> Omg thanks problem solved. Can you give me more documentation about that.
http://web2py.com/books/default/chapter/29/04/the-core#request

and maybe you would like to read also...
http://web2py.com/books/default/chapter/29/04/the-core#response
http://web2py.com/books/default/chapter/29/04/the-core#session


:)

M.

-- 
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: Adding class='hidden' creates an element style='display: none'

2015-09-17 Thread Stuart Rolinson
That got it, thank you.

On Wednesday, September 16, 2015 at 8:25:18 AM UTC-7, Leonel Câmara wrote:
>
> web2py.js does that, I think it's because of appadmin using class hidden 
> and since appadmin uses your app's layout it may not have the css saying 
> it's supposed to be display:none, but to be frank I'm not sure. You can 
> just delete the line that does it that looks like this because bootstrap 
> already has the hidden display: none style.
>
> $('.hidden', target).hide();
>
>
>  
>

-- 
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: Is it possible to have this type of multiple requires in db.py?

2015-09-17 Thread Leonel Câmara
Yes its wrong I'm sorry I didn't notice it. You got the order wrong. It 
should be:

Field('organizationID','reference Organization', requires = IS_IN_DB(db.
Organization.organizationPrimaryTypeID == 1, 'Organization.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.


Re: [web2py] Re: web2py SPA(single page application)

2015-09-17 Thread António Ramos
I get it
you meant  "Changing"  right ?
this is the way Vue.config.delimiters = ['(%', '%)'];

2015-09-16 23:27 GMT+01:00 António Ramos :

> Massimo, can you explain what it "chancing the triple delimiters" ?
>
> i used web2py with vuejs without a problem...
>
>
> for example i import my app.js  in my view to kick vuejs
>
> (function ($, Vue) {
>
> $(document).ready(function () {
> Vue.config.delimiters = ['(%', '%)'];
>
> new Vue({
>   el: '#demo',
>   data: {
>var1:'aa'
>
>   },
>   filters:{
>   first:function(value,stop){
>   return value.slice(0,stop);
>   }
>
>   },
>   methods:
>   {
> selectFormula:function(form){
>
>   },
> log: function(arg) {
> console.log(arg);
> },
>
> },
> ready:function(){
>
> }
>});
>   });
> })($, Vue);
>
> 2015-09-16 22:20 GMT+01:00 Massimo Di Pierro :
>
>> I had problems with vue.js Like chancing the triple delimiters did not
>> work for me.
>>
>>
>> On Wednesday, 16 September 2015 09:37:06 UTC-5, Ramos wrote:
>>>
>>> My favourite is Vuejs
>>> learn from here
>>>
>>> http://vuejs.org/guide/
>>> https://laracasts.com/series/learning-vuejs
>>> you can go very crazy with it
>>>
>>>
>>> 2015-09-16 15:05 GMT+01:00 Márcio Almeida <
>>> marciolauriano.alme...@gmail.com>:
>>>
 Thank you, I will study it.
 If anyone has more information, please post.

 Em segunda-feira, 14 de setembro de 2015 22:14:53 UTC-3, Márcio Almeida
 escreveu:
>
> Hi, I'm trying to create a spa-like application to not reload it
> whenever you change page, I tried example of web2pyslices but
> only charges the index page, the other I did not know how to load (
> http://www.web2pyslices.com/slice/show/2030/creating-a-single-page-app-with-web2py
> ).
> Has anyone had any experience with this or know how to evolve the
> example of web2pyslices?
> Some solution in web2py?
> I think some will tell me about angularjs etc, okay with it gives, but
> did not want to mix things up, native web2py does it have any way out?
>
> Thanks people.
>
 --
 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.
>>
>
>

-- 
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: SQLform grid custom function for delete

2015-09-17 Thread Vid Ogris
I am trying with something like this

links = [lambda row: A('',_class='glyphicon glyphicon
glyphicon-remove-sign',
_href =URL('settings','deactivate',
vars=dict(s = '2')))]

But I cannot send vars to my controller function

I also tried with callback()

Any idea why?

I need to send id of the record and two static parametes e.g. 'tablename',
'tablefiled'



2015-09-14 23:46 GMT+08:00 Vid Ogris :

> Thank you for fast reply
>
> Will try with links. I have more then just active or inactive status, so i
> guess the other option is out. But will keep that in mind for next projects
> and/or tasks
>
> thank you again
>
> 2015-09-14 23:42 GMT+08:00 Anthony :
>
>> You can use the "links" argument to create additional buttons/links,
>> either in separate columns or in the column that includes the
>> view/edit/delete buttons.
>>
>> Alternatively, you might consider setting up record versioning, either
>> for just this table
>> ,
>> or for the whole database
>> .
>> If you include an "is_active" boolean field in the table, the record
>> versioning functionality will preserve all records and simply set
>> is_active=False for deleted records (it will also add a common_filter to
>> the table to filter out is_active=False records from all queries).
>>
>> If you want the is_active/filtering functionality of record versioning
>> but you don't actually want to save the older versions of records in an
>> archive table, you can do this manually by (a) adding your own
>> common_filter to filter out inactive records, and (b) adding a
>> _before_delete callback that sets in_active=False and then abandons the
>> delete operation.
>>
>> The benefit if using the record versioning functionality (or manual
>> alternative described above) is that it will apply to any delete operations
>> on the table (done via the DAL), not just those coming from this particular
>> grid interface.
>>
>> Anthony
>>
>>
>> On Monday, September 14, 2015 at 11:21:13 AM UTC-4, Yebach wrote:
>>>
>>> Hello
>>>
>>> Is there a way to use SQLform.grid and add a function and new buttons
>>> for delete record and other purposos
>>>
>>> I do not allow user to actually delete records just to change status in
>>> database, so the record still stays there.
>>>
>>>
>>> Any suggestions?
>>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Lep pozdrav
>
> Vid Ogris
>
>
>


-- 
Lep pozdrav

Vid Ogris

-- 
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: Self-referencing tables and queries

2015-09-17 Thread Carla Raquel
*So what? You should future proof the app. Some day there might be 
extensions in India or something.*

Actually, the extensions are internal to the company, either phone numbers 
or mobile numbers, so your scenario won't ever apply.

*Do you mean the extensions of the persons he supervises?*

That is what he already does, which is what I don't want it to do. I'll 
give an example,so that you can visualize it better:

Supervisor X has two extensions: 5589,5590
Supervisor X supervises two people: A and B
A has two extensions: 4572,4573
B has one extension: 4321

My current query returns: 5589,5590,4572,4573,4321
What I want it to returns: 5589,5590

Conclusion: Just the Supervisor extensions


quarta-feira, 16 de Setembro de 2015 às 18:15:53 UTC+1, Leonel Câmara 
escreveu:
>
> > I think in this case they won't be strings since I read the numbers from 
> a XML and they don't have the '+' character
>
> So what? You should future proof the app. Some day there might be 
> extensions in India or something.
>
> > Not all the supervisors.I want to get the extensions of a particular 
> supervisor
>
> Do you mean the extensions of the persons he supervises? If so:
>
> the_supervised = db(db.auth_user.Supervisor == 
> ParticularSupervisor.id)._select(db.auth_user.id)
> extensions_of_the_supervised = 
> db(db.Extension.Person.belongs(the_supervised)).select()
>
> This will give you the extensions of everyone that is supervised by this 
> person.  
>
>
>

-- 
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: Self-referencing tables and queries

2015-09-17 Thread António Ramos
+1
*There's no need for an extension to have a supervisor, because the
supervisor is already stored in Person. !!!*

2015-09-17 11:10 GMT+01:00 Carla Raquel :

> *So what? You should future proof the app. Some day there might be
> extensions in India or something.*
>
> Actually, the extensions are internal to the company, either phone numbers
> or mobile numbers, so your scenario won't ever apply.
>
> *Do you mean the extensions of the persons he supervises?*
>
> That is what he already does, which is what I don't want it to do. I'll
> give an example,so that you can visualize it better:
>
> Supervisor X has two extensions: 5589,5590
> Supervisor X supervises two people: A and B
> A has two extensions: 4572,4573
> B has one extension: 4321
>
> My current query returns: 5589,5590,4572,4573,4321
> What I want it to returns: 5589,5590
>
> Conclusion: Just the Supervisor extensions
>
>
> quarta-feira, 16 de Setembro de 2015 às 18:15:53 UTC+1, Leonel Câmara
> escreveu:
>>
>> > I think in this case they won't be strings since I read the numbers
>> from a XML and they don't have the '+' character
>>
>> So what? You should future proof the app. Some day there might be
>> extensions in India or something.
>>
>> > Not all the supervisors.I want to get the extensions of a particular
>> supervisor
>>
>> Do you mean the extensions of the persons he supervises? If so:
>>
>> the_supervised = db(db.auth_user.Supervisor ==
>> ParticularSupervisor.id)._select(db.auth_user.id)
>> extensions_of_the_supervised =
>> db(db.Extension.Person.belongs(the_supervised)).select()
>>
>> This will give you the extensions of everyone that is supervised by this
>> person.
>>
>>
>> --
> 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.


[web2py] Re: Self-referencing tables and queries

2015-09-17 Thread Leonel Câmara
> Actually, the extensions are internal to the company, either phone 
numbers or mobile numbers, so your scenario won't ever apply.

Fine, I disagree with this assumption but I'm not your client.


> Conclusion: Just the Supervisor extensions

Well this is very easy, the Supervisor is just a Person like everyone else. 
So all you need is

# Assuming you're getting the id of the supervisor you want the extensions 
for in request.args(0)
supervisor =  db.auth_user[request.args(0)]   
supervisor_extensions = db(db.Extension.Person == supervisor.id).select()




-- 
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: SQLform grid custom function for delete

2015-09-17 Thread Anthony
What do you mean you cannot send vars? Exactly what is happening? Please show 
more code.

-- 
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: Is it possible to have this type of multiple requires in db.py?

2015-09-17 Thread Anthony
On Thursday, September 17, 2015 at 3:08:31 AM UTC-4, Leonel Câmara wrote:
>
> Yes its wrong I'm sorry I didn't notice it. You got the order wrong. It 
> should be:
>
> Field('organizationID','reference Organization', requires = IS_IN_DB(db.
> Organization.organizationPrimaryTypeID == 1, 'Organization.id')),
>

Note, the first argument should be a Set, not a Query.

Anthony 

-- 
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: Why do i have to submit the form twice in order to work?

2015-09-17 Thread Anthony
No need for all this -- you can still use the method I proposed, creating 
just a single form (and giving it an explicit name). As you build each form 
in the view, just include a hidden "id" field and set its value to row.id 
(no need to use the "hidden" argument to SQLFORM, as you will be adding the 
hidden fields explicitly in the view).

Anthony

On Thursday, September 17, 2015 at 3:50:46 AM UTC-4, Alfonso Serra wrote:
>
> And this does work, which is very bad.
>
> def example2():
> 
> rows = db(db.agencias).select()
>
> #create as many forms as rows
> forms = dict()
> for row in rows:
> forms[row.id] = SQLFORM(db.agencias, row.id).process()
> 
> fields = forms.itervalues().next().fields
>
> if request.post_vars:
> id = request.post_vars.id
> if isinstance(id, list): id = id[-1] #get the id from the hidden 
> field, not the record
>
> form = forms[int(id)] #get the corresponding form
>
> if form.accepted:
> print "all good"
> elif form.errors:
> print "not good"
> else:
> print "welcome"
>
> rows = db(db.agencias).select()
> return locals()
>
> This is bad since you have to query the db twice, and create as many 
> SQLFORM instances as records, also bad.
>
> Smartgrid and grid doesnt look like they fit my needs, ill keep reading 
> about them but they expose several routes to edit a record when im trying 
> to update them in a single view.
>
> If i could use a dummy SQLFORM that passes a db.table validation of a 
> random incoming post would be enough. ill keep trying. 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: SQLFORM grid, adding buttons

2015-09-17 Thread Niphlod
"view" depends on the details=False argument
"add record" on the create=False

Its working exactly as requested :P

-- 
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: Is it possible to have this type of multiple requires in db.py?

2015-09-17 Thread Anthony
The first argument to IS_IN_DB can be either a DAL object (i.e., just "db") 
or a Set object (which is what you want). The second argument must be a 
field (either a field object or the name in 'tablename.fieldname' form) -- 
it cannot be a Query object, as you are using. So, you want:

IS_IN_DB(db(db.Organization.organizationPrimaryTypeID == 1), 
'Organization.id')

This is explained in the book 

.

You might also want to include db.Organization._format as the third 
argument, so the labels in the select element will be based on the "format" 
attribute of the Organization table.

Regarding your other initial attempts:

   - If you are going to use a lambda function as a validator, not that it 
   must take a Field object as its first argument and the value to be 
   validated as its second argument, and it must return a tuple, with the 
   (possibly transformed) value as the first element, and either None or an 
   error message as the second.
   - If you put IS_IN_DB in a list, you won't get a dropdown in forms. To 
   use additional validators with IS_IN_DB but still get the dropdown, instead 
   of putting it in a list, pass the additional validators as its "_and" 
   argument (also documented in the book).

Anthony

On Wednesday, September 16, 2015 at 8:34:32 PM UTC-4, Alex Glaros wrote:
>
> okay, I get similar error no matter what table or fields used.
>
> Is this syntax wrong?
>
> Field('organizationID','reference Organization', requires = IS_IN_DB(db, 
> db.Organization.organizationPrimaryTypeID == 1)), 
>
>
>

-- 
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: Has anyone integrated user-driven multiprocessing?

2015-09-17 Thread Anthony
Niphlod can probably provide better advice regarding managing scheduler 
workers and system resources, but yes, you should be able to have a few 
workers running ready to handle incoming tasks.

On Wednesday, September 16, 2015 at 6:11:08 PM UTC-4, Phillip wrote:
>
> Are you saying that if I start the workers before any tasks are queued (by 
> an arbitrary number of users), the workers will be idle in wait for queued 
> tasks?
>
> If the answer is no
>
> Here is the set up: There is a grid of files from which a user can 
> generate 'offspring' files in all possible combinations. Previous 
> inquiry has led me to think the scheduler could be used for multiprocessing 
> here (instead of the ostensibly problematic multiprocessing module). 
> The queued tasks are derived from the python script that processes 
> user-selected files, called in the controller when these file id's are 
> passed via ajax.
>
> Otherwise,
>
> Is there a brick wall here? If, for instance, the app was on Google App 
> Engine, could a large number of idle workers simply be started to handle 
> spikes in user requests?
>
>
> Thank you for the response 
>
>  
>
>  
>
>

-- 
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] oparation on forms

2015-09-17 Thread zakaria danone
Hi,
i'm new on web2py and i try to create a simple app for billing
user will enter unit price and quantity and sum automati apper
on form row1*row2 = sum
  cant someone help me
thank's

-- 
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] SQLFORM grid, adding buttons

2015-09-17 Thread Ron Chatterjee
Is any reason that I don't see "add record" and "view" button with my 
sqlform.grid (like shown in the example 
here: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid)?
 

When I use @auth.requires_login(). I do see the edit and delete button.


# db.py
db.define_table(
'members',
Required('name'),
Field('start_date', 'datetime'),
Field('Education','string'),
Field('work interest','string'),
Field('Telnumber',type='string',label= T('Telephone number'), length = 
64 ),
Field('Address','string'),
Field('Emergency_Contract_Name','string'),
Field('Emergency_Contract_Phone',type='string',label= T('Telephone 
number'), length = 64 ),
auth.signature)



#default
@auth.requires_login()
def index():
if_author = lambda row: (row.created_by==auth.user_id)
db.members.name.represent = lambda name,row: 
A(name,_href=URL('Our_Members',args=(row.id,IS_SLUG.urlify(name
grid = 
SQLFORM.grid(db.members,args=request.args[:1],editable=if_author,deletable=if_author,details=False,create=False,csv=False)
return locals()

-- 
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: web2py SPA(single page application)

2015-09-17 Thread António Ramos
I think you wont have that problem after 1.0


Unsafe delimiters for HTML interpolation can now be configured separately:

Vue.config.unsafeDelimiters = ['{!!', '!!}']
Note in 1.0.0-alpha when you set Vue.config.delimiters, it will still
implicitly update the unsafe delimiters following the current rules, but in
1.0.0-beta and above setting delimiters will have no effect on
unsafeDelimiters.
...
Em 17/09/2015 19:18, "Massimo Di Pierro" 
escreveu:

> In vue.js there are unsafe_delimiters
> and they change automatically when you set delimiters. So I chose
> delimiters to e '{%','%}' and it automatically changed unsafe_delimiters to
> '{{%','%}}' so it was conflicting with web2py delimiters {{.}}.
>
>
> On Thursday, 17 September 2015 03:25:43 UTC-5, Ramos wrote:
>>
>> I get it
>> you meant  "Changing"  right ?
>> this is the way Vue.config.delimiters = ['(%', '%)'];
>>
>> 2015-09-16 23:27 GMT+01:00 António Ramos :
>>
>>> Massimo, can you explain what it "chancing the triple delimiters" ?
>>>
>>> i used web2py with vuejs without a problem...
>>>
>>>
>>> for example i import my app.js  in my view to kick vuejs
>>>
>>> (function ($, Vue) {
>>>
>>> $(document).ready(function () {
>>> Vue.config.delimiters = ['(%', '%)'];
>>>
>>> new Vue({
>>>   el: '#demo',
>>>   data: {
>>>var1:'aa'
>>>
>>>   },
>>>   filters:{
>>>   first:function(value,stop){
>>>   return value.slice(0,stop);
>>>   }
>>>
>>>   },
>>>   methods:
>>>   {
>>> selectFormula:function(form){
>>>
>>>   },
>>> log: function(arg) {
>>> console.log(arg);
>>> },
>>>
>>> },
>>> ready:function(){
>>>
>>> }
>>>});
>>>   });
>>> })($, Vue);
>>>
>>> 2015-09-16 22:20 GMT+01:00 Massimo Di Pierro >> >:
>>>
 I had problems with vue.js Like chancing the triple delimiters did not
 work for me.


 On Wednesday, 16 September 2015 09:37:06 UTC-5, Ramos wrote:
>
> My favourite is Vuejs
> learn from here
>
> http://vuejs.org/guide/
> https://laracasts.com/series/learning-vuejs
> you can go very crazy with it
>
>
> 2015-09-16 15:05 GMT+01:00 Márcio Almeida <
> marciolauriano.alme...@gmail.com>:
>
>> Thank you, I will study it.
>> If anyone has more information, please post.
>>
>> Em segunda-feira, 14 de setembro de 2015 22:14:53 UTC-3, Márcio
>> Almeida escreveu:
>>>
>>> Hi, I'm trying to create a spa-like application to not reload it
>>> whenever you change page, I tried example of web2pyslices but
>>> only charges the index page, the other I did not know how to load (
>>> http://www.web2pyslices.com/slice/show/2030/creating-a-single-page-app-with-web2py
>>> ).
>>> Has anyone had any experience with this or know how to evolve the
>>> example of web2pyslices?
>>> Some solution in web2py?
>>> I think some will tell me about angularjs etc, okay with it gives,
>>> but did not want to mix things up, native web2py does it have any way 
>>> out?
>>>
>>> Thanks people.
>>>
>> --
>> 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.

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

[web2py] Re: XML pickle/unpickle

2015-09-17 Thread Massimo Di Pierro
Weird. Can you open a ticket and I will test it asap?

On Wednesday, 16 September 2015 13:31:40 UTC-5, Maxim wrote:
>
>
> Why do you want comment it out anyway?
>>
>
> This: 
>
>> The reason is that is allows storing variables that contain XML('.') 
>> in sessions. That is useful to deal with flash messages that contain more 
>> than just text. 
>
>
> I want to store XML in session flash message, like Massimo stated, but in 
> fact this code prevents to do it. If I try 
> session.flash = XML('Hello world')
> the output is "Hello world", and if I comment out the code above, 
> the output is as desired "Hello *world*".
>

-- 
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: oparation on forms

2015-09-17 Thread 黄祥
perhaps you can take a look at web2py appliances about posonlinestore
http://www.web2py.com/appliances
https://github.com/mdipierro/web2py-appliances

best regards,
stifan

-- 
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: SQLform grid custom function for delete

2015-09-17 Thread Dave S


On Thursday, September 17, 2015 at 3:55:48 AM UTC-7, Anthony wrote:
>
> What do you mean you cannot send vars? Exactly what is happening? Please 
> show more code.



The snippet above looks lik he's trying to set vars within the URL helper 
inside the lambda.  Is he trying to make a link that looks like this?
  http://mydomain/myapp/settings/deactivate/vars={(s,'2')}
(abusing dict notation slightly)

/dps

-- 
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: oparation on forms

2015-09-17 Thread Dave S


On Thursday, September 17, 2015 at 8:03:13 AM UTC-7, zakaria danone wrote:
>
> Hi,
> i'm new on web2py and i try to create a simple app for billing
> user will enter unit price and quantity and sum automati apper
> on form row1*row2 = sum
>   cant someone help me
> thank's
>

Would a computed field help with this?

>From the book's example:

>>> db.define_table('item',
Field('unit_price','double'),
Field('quantity','integer'),
Field('total_price',
compute=lambda r: r['unit_price']*r['quantity']))
>>> r = db.item.insert(unit_price=1.99, quantity=5)
>>> print r.total_price
9.95




In your controller, you would just return the form (instead of printing to 
the console), and on form.accept the total_price would now be displayed.

If you wanted to generate the total price as they entered the other values, 
you'd want to use Javascript to do the calculation ("onselect" or such).

/dps

-- 
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: Calling all Boulder, CO web2py users

2015-09-17 Thread Jim S
Can't commit til I hear the dates but am interested.

-Jim

On Thursday, September 17, 2015 at 2:33:26 PM UTC-5, weheh wrote:
>
> *** Please reply to this thread if you're interested in a Boulder, CO 
> web2py meetup. ***
>
> Hello Boulder web2py users. I organized a very well received web2py meetup 
> in Berkeley, CA, last year with Massimo and would like to repeat something 
> like it in Boulder, CO. 
>
> Massimo has committed to attend and give a talk. The time frame would be 
> early winter because Massimo likes to ski, as do I. :)
>
> I will volunteer a talk about designing and building sites with web2py and 
> Ractive.js.
>
> Anyone else is welcome to propose a talk.
>
> I've spoken with the Boulder python Meetup.com organizers and they're open 
> to having a web2py session, so let's do it!
>
> What do you think? Want to attend? Volunteer a talk? Not sure but 
> interested? Let us know one way or the other. 
>
> - Richard
>
> *** Please reply to this thread if you're interested in a Boulder, CO 
> web2py meetup. ***
>
>

-- 
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: web2py SPA(single page application)

2015-09-17 Thread JorgeH
so, why is Vue better than Ractive?

or viceversa...

On Thursday, September 17, 2015 at 1:44:03 PM UTC-5, Ramos wrote:
>
> I think you wont have that problem after 1.0
>
> 
> Unsafe delimiters for HTML interpolation can now be configured separately:
>
> Vue.config.unsafeDelimiters = ['{!!', '!!}']
> Note in 1.0.0-alpha when you set Vue.config.delimiters, it will still 
> implicitly update the unsafe delimiters following the current rules, but in 
> 1.0.0-beta and above setting delimiters will have no effect on 
> unsafeDelimiters.
> ...
> Em 17/09/2015 19:18, "Massimo Di Pierro"  > escreveu:
>
>> In vue.js there are unsafe_delimiters 
>> and they change automatically when you set delimiters. So I chose 
>> delimiters to e '{%','%}' and it automatically changed unsafe_delimiters to 
>> '{{%','%}}' so it was conflicting with web2py delimiters {{.}}.
>>
>>
>> On Thursday, 17 September 2015 03:25:43 UTC-5, Ramos wrote:
>>>
>>> I get it 
>>> you meant  "Changing"  right ?
>>> this is the way Vue.config.delimiters = ['(%', '%)'];
>>>
>>> 2015-09-16 23:27 GMT+01:00 António Ramos >> >:
>>>
 Massimo, can you explain what it "chancing the triple delimiters" ?

 i used web2py with vuejs without a problem...


 for example i import my app.js  in my view to kick vuejs

 (function ($, Vue) {

 $(document).ready(function () {
 Vue.config.delimiters = ['(%', '%)'];

 new Vue({
   el: '#demo',
   data: {
var1:'aa'

   },
   filters:{
   first:function(value,stop){
   return value.slice(0,stop);
   }
   
   },
   methods: 
   {
 selectFormula:function(form){
 
   },
 log: function(arg) {
 console.log(arg);
 },
  
 },
 ready:function(){

 }
});
   });
 })($, Vue);

 2015-09-16 22:20 GMT+01:00 Massimo Di Pierro :

> I had problems with vue.js Like chancing the triple delimiters did not 
> work for me.
>
>
> On Wednesday, 16 September 2015 09:37:06 UTC-5, Ramos wrote:
>>
>> My favourite is Vuejs
>> learn from here
>>
>> http://vuejs.org/guide/
>> https://laracasts.com/series/learning-vuejs
>> you can go very crazy with it
>>
>>
>> 2015-09-16 15:05 GMT+01:00 Márcio Almeida > >:
>>
>>> Thank you, I will study it.
>>> If anyone has more information, please post.
>>>
>>> Em segunda-feira, 14 de setembro de 2015 22:14:53 UTC-3, Márcio 
>>> Almeida escreveu:

 Hi, I'm trying to create a spa-like application to not reload it 
 whenever you change page, I tried example of web2pyslices but
 only charges the index page, the other I did not know how to load (
 http://www.web2pyslices.com/slice/show/2030/creating-a-single-page-app-with-web2py
 ).
 Has anyone had any experience with this or know how to evolve the 
 example of web2pyslices?
 Some solution in web2py?
 I think some will tell me about angularjs etc, okay with it gives, 
 but did not want to mix things up, native web2py does it have any way 
 out?

 Thanks people.

>>> -- 
>>> 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+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+un...@googlegroups.com .
>> For more options, visit 

[web2py] Re: Has anyone integrated user-driven multiprocessing?

2015-09-17 Thread Niphlod
The basic concept of the scheduler is to have a process (or multiple ones) 
NOT managed by the webserver, that are ready to do some work when told to 
do so.
Why ? 99% of the cases is composed by:
- long-running computations that will incur in the webserver dropping the 
process for timeout
- async processing of a task to make the webapp feel "snappier" while 
providing the same functionality

Starting an external process from a "web-served" process is a contradiction 
in terms: we don't want zombie processes and as soon as the webserver kills 
the "originator", the worker would be terminated too.
Another good reason to not provide that functionality is that one may want 
to run the task on a totally different server than the "web-serving" one 
(decoupling).
This is on top of the fact that managing long-running processes is best 
done by softwares specifically engineered to do so, and highly 
platform-dependant.
Given that starting those processes (and restart them if they die, etc etc 
etc) is fairly easy to set up with what the underlying OS provides, and 
that most of them are covered in the book, it shouldn't be hard to set up a 
scheduler.

That being said, the "scheduler architecture" relies on a never-ending 
process that loops over inifitely searching for tasks to be executed, 
sleeping when no tasks are ready to be processed. Every process is in 
charge of executing one task at a time, and the same task can't be executed 
at the same time by another worker.
In your case it translates to starting one - or a few - scheduler processes 
and to queue tasks from your application. As soon as a worker is ready to 
process those, they'll get picked up and executed. 


-- 
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: Is it possible to have this type of multiple requires in db.py?

2015-09-17 Thread Alex Glaros
Thanks Leonel and Anthony,

works great.  

is used in many places and has greatly improved my app.

much appreciated,

Alex

-- 
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: SQLFORM grid, adding buttons

2015-09-17 Thread Ron Chatterjee
Thank you. 

On Thursday, September 17, 2015 at 12:06:33 PM UTC-4, Niphlod wrote:
>
> "view" depends on the details=False argument
> "add record" on the create=False
>
> Its working exactly as requested :P
>
>

-- 
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] SQLFORM.grid and ractive

2015-09-17 Thread weheh
Anybody ever try to get an SQLFORM.grid(...) to render within a ractive 
template? I'm having trouble getting it to work. SQLTABLE works OK, but 
grid seems to bundle a script, which causes ractive to choke.

-- 
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] Calling all Boulder, CO web2py users

2015-09-17 Thread weheh
*** Please reply to this thread if you're interested in a Boulder, CO 
web2py meetup. ***

Hello Boulder web2py users. I organized a very well received web2py meetup 
in Berkeley, CA, recently and would like to repeat something like it in 
Boulder, CO. Massimo has committed to attend and give a talk. The time 
frame would be in early winter because Massimo likes to ski, as do I. :)

I will volunteer a talk about designing and building sites with web2py and 
Ractive.js.

Anyone else is welcome to propose a talk.

I've spoken with the Boulder python Meetup.com organizers and they're open 
to having a web2py session, so let's do it!

What do you think? Want to volunteer a talk?

*** Please reply to this thread if you're interested in a Boulder, CO 
web2py meetup. ***

-- 
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] Authenticate with Radius Server

2015-09-17 Thread Fabiano Almeida
Hi @ll!

I have an pfSense server with FreeRadius. Can I log in web2py app with
users from FreeRadius? How?

thx!

-- 
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: web2py SPA(single page application)

2015-09-17 Thread António Ramos
Im not saying better. I said favourite.
The docs are very good. Never gave ractive a chance because the docs were
not very appealing at first sight.
Only my opinion.
Em 17/09/2015 21:14, "JorgeH"  escreveu:

> so, why is Vue better than Ractive?
>
> or viceversa...
>
> On Thursday, September 17, 2015 at 1:44:03 PM UTC-5, Ramos wrote:
>>
>> I think you wont have that problem after 1.0
>>
>> 
>> Unsafe delimiters for HTML interpolation can now be configured separately:
>>
>> Vue.config.unsafeDelimiters = ['{!!', '!!}']
>> Note in 1.0.0-alpha when you set Vue.config.delimiters, it will still
>> implicitly update the unsafe delimiters following the current rules, but in
>> 1.0.0-beta and above setting delimiters will have no effect on
>> unsafeDelimiters.
>> ...
>> Em 17/09/2015 19:18, "Massimo Di Pierro" 
>> escreveu:
>>
>>> In vue.js there are unsafe_delimiters
>>> and they change automatically when you set delimiters. So I chose
>>> delimiters to e '{%','%}' and it automatically changed unsafe_delimiters to
>>> '{{%','%}}' so it was conflicting with web2py delimiters {{.}}.
>>>
>>>
>>> On Thursday, 17 September 2015 03:25:43 UTC-5, Ramos wrote:

 I get it
 you meant  "Changing"  right ?
 this is the way Vue.config.delimiters = ['(%', '%)'];

 2015-09-16 23:27 GMT+01:00 António Ramos :

> Massimo, can you explain what it "chancing the triple delimiters" ?
>
> i used web2py with vuejs without a problem...
>
>
> for example i import my app.js  in my view to kick vuejs
>
> (function ($, Vue) {
>
> $(document).ready(function () {
> Vue.config.delimiters = ['(%', '%)'];
>
> new Vue({
>   el: '#demo',
>   data: {
>var1:'aa'
>
>   },
>   filters:{
>   first:function(value,stop){
>   return value.slice(0,stop);
>   }
>
>   },
>   methods:
>   {
> selectFormula:function(form){
>
>   },
> log: function(arg) {
> console.log(arg);
> },
>
> },
> ready:function(){
>
> }
>});
>   });
> })($, Vue);
>
> 2015-09-16 22:20 GMT+01:00 Massimo Di Pierro :
>
>> I had problems with vue.js Like chancing the triple delimiters did
>> not work for me.
>>
>>
>> On Wednesday, 16 September 2015 09:37:06 UTC-5, Ramos wrote:
>>>
>>> My favourite is Vuejs
>>> learn from here
>>>
>>> http://vuejs.org/guide/
>>> https://laracasts.com/series/learning-vuejs
>>> you can go very crazy with it
>>>
>>>
>>> 2015-09-16 15:05 GMT+01:00 Márcio Almeida 
>>> :
>>>
 Thank you, I will study it.
 If anyone has more information, please post.

 Em segunda-feira, 14 de setembro de 2015 22:14:53 UTC-3, Márcio
 Almeida escreveu:
>
> Hi, I'm trying to create a spa-like application to not reload it
> whenever you change page, I tried example of web2pyslices but
> only charges the index page, the other I did not know how to load (
> http://www.web2pyslices.com/slice/show/2030/creating-a-single-page-app-with-web2py
> ).
> Has anyone had any experience with this or know how to evolve the
> example of web2pyslices?
> Some solution in web2py?
> I think some will tell me about angularjs etc, okay with it gives,
> but did not want to mix things up, native web2py does it have any way 
> out?
>
> Thanks people.
>
 --
 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+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)
>>> - 

Re: [web2py] Re: web2py SPA(single page application)

2015-09-17 Thread Massimo Di Pierro
In vue.js there are unsafe_delimiters 
and they change automatically when you set delimiters. So I chose 
delimiters to e '{%','%}' and it automatically changed unsafe_delimiters to 
'{{%','%}}' so it was conflicting with web2py delimiters {{.}}.


On Thursday, 17 September 2015 03:25:43 UTC-5, Ramos wrote:
>
> I get it 
> you meant  "Changing"  right ?
> this is the way Vue.config.delimiters = ['(%', '%)'];
>
> 2015-09-16 23:27 GMT+01:00 António Ramos :
>
>> Massimo, can you explain what it "chancing the triple delimiters" ?
>>
>> i used web2py with vuejs without a problem...
>>
>>
>> for example i import my app.js  in my view to kick vuejs
>>
>> (function ($, Vue) {
>>
>> $(document).ready(function () {
>> Vue.config.delimiters = ['(%', '%)'];
>>
>> new Vue({
>>   el: '#demo',
>>   data: {
>>var1:'aa'
>>
>>   },
>>   filters:{
>>   first:function(value,stop){
>>   return value.slice(0,stop);
>>   }
>>   
>>   },
>>   methods: 
>>   {
>> selectFormula:function(form){
>> 
>>   },
>> log: function(arg) {
>> console.log(arg);
>> },
>>  
>> },
>> ready:function(){
>>
>> }
>>});
>>   });
>> })($, Vue);
>>
>> 2015-09-16 22:20 GMT+01:00 Massimo Di Pierro 
>> :
>>
>>> I had problems with vue.js Like chancing the triple delimiters did not 
>>> work for me.
>>>
>>>
>>> On Wednesday, 16 September 2015 09:37:06 UTC-5, Ramos wrote:

 My favourite is Vuejs
 learn from here

 http://vuejs.org/guide/
 https://laracasts.com/series/learning-vuejs
 you can go very crazy with it


 2015-09-16 15:05 GMT+01:00 Márcio Almeida <
 marciolauriano.alme...@gmail.com>:

> Thank you, I will study it.
> If anyone has more information, please post.
>
> Em segunda-feira, 14 de setembro de 2015 22:14:53 UTC-3, Márcio 
> Almeida escreveu:
>>
>> Hi, I'm trying to create a spa-like application to not reload it 
>> whenever you change page, I tried example of web2pyslices but
>> only charges the index page, the other I did not know how to load (
>> http://www.web2pyslices.com/slice/show/2030/creating-a-single-page-app-with-web2py
>> ).
>> Has anyone had any experience with this or know how to evolve the 
>> example of web2pyslices?
>> Some solution in web2py?
>> I think some will tell me about angularjs etc, okay with it gives, 
>> but did not want to mix things up, native web2py does it have any way 
>> out?
>>
>> Thanks people.
>>
> -- 
> 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.
>>>
>>
>>
>

-- 
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] Nginx proxy for Apache error

2015-09-17 Thread Nguyen Minh Tuan
Hi,

I setup Web2py with Apache successfully, but when I setup a Nginx proxy for 
Apache server I get error :

---
(getattr(): attribute name must be string)
Traceback (most recent call last):
  File "C:\web2py\gluon\main.py", line 436, in wsgibase
session.connect(request, response)
  File "C:\web2py\gluon\globals.py", line 960, in connect
session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
  File "C:\web2py\gluon\storage.py", line 56, in 
getnewargs = lambda self: getattr(dict,self).__getnewargs__(self)
TypeError: getattr(): attribute name must be string
---

Environment :
- Web2py 2.11.2
- Apache 2.2.25
- Nginx 1.0.15

Nginx proxy setting :

upstream  qlkh {
ip_hash;

server 192.168.128.4:8080;
}

server {
 listen80;

location / {

  if ($request_uri ~* 
".(jpg|jpeg|gif|gz|zip|flv|rar|wmv|avi|css|swf|png|htc|ico|mpeg|mpg|txt|mp3|mov|js)(\?v=[0-9.]+)?$")
 
{
   expires 30d;
   break;
  }

  proxy_set_header   Host   $host;
  proxy_set_header   X-Real-IP  $remote_addr;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  add_header X-Cache-Status $upstream_cache_status;

  proxy_pass   http://qlkh;
 }
}

Does anyone got this error? please help!

Thanks in advance!
Tuan.

-- 
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: Authenticate with Radius Server

2015-09-17 Thread Leonel Câmara
I have zero experience with Radius, however there's no reason you could not 
make your custom login_method using an appropriate python radius client 
(I'm sure there are modules for that in pypi) check 
gluon/contrib/login_methods for examples of custom logins.

-- 
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: XML pickle/unpickle

2015-09-17 Thread Maxim
I did yesterday, issue #1067.

I think the solution may be to replace:
671 return marshal.loads(data)
with
671 return XML(marshal.loads(data))






On Thursday, September 17, 2015 at 9:11:58 PM UTC+3, Massimo Di Pierro 
wrote:
>
> Weird. Can you open a ticket and I will test it asap?
>
> On Wednesday, 16 September 2015 13:31:40 UTC-5, Maxim wrote:
>>
>>
>> Why do you want comment it out anyway?
>>>
>>
>> This: 
>>
>>> The reason is that is allows storing variables that contain XML('.') 
>>> in sessions. That is useful to deal with flash messages that contain more 
>>> than just text. 
>>
>>
>> I want to store XML in session flash message, like Massimo stated, but in 
>> fact this code prevents to do it. If I try 
>> session.flash = XML('Hello world')
>> the output is "Hello world", and if I comment out the code above, 
>> the output is as desired "Hello *world*".
>>
>

-- 
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: Why do i have to submit the form twice in order to work?

2015-09-17 Thread Alfonso Serra
Hi Anthony. ye ive tried, tricked the view so it has unique form names but 
on submission, if i call process, it wont pass validation. Im probably doin 
it wrong but ive manage to get it working.

Ive decided to make a video out of this, so i can explain the problems im 
having and how did i solve them.

https://vimeo.com/139667814

Thanks everyone.


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