[web2py] Re: redirect after registration issue

2013-06-07 Thread lesssugar
That's my concern also. I simply would like to make a transparent 
registration for 2 groups separately. In order to do so I have two 
different forms generating depending on URL argument: 
default/register/[group1] or [group2]. Checking request.args(0) on 
"onaccept" seemed obvious but it needs improvements.

Is it a good idea to check also a specific form id attribute when 
performing onaccept? How do I check the form id attribute value? Or maybe 
there's a better way do make sure noone messes with the URL arguments?

On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>
> Yes, you should not call .process() after calling auth.register() because 
> the second time through .process() it will fail (the _formkey token is only 
> good for one process -- so it fails on the second). Using an onaccept 
> callback is the way to go. However, it appears you are allowing your users 
> to assign themselves to any arbitrary group simply by manipulating an arg 
> in the URL -- that doesn't seem like a good idea.
>
> Anthony
>
> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:
>>
>> OK, I figured out something like this and it works (let me know if it's 
>> not correct in any way):
>>
>> In db.py model:
>>
>> auth.settings.create_user_groups = False
>>
>> and then
>>
>> def add_group(form):
>> group_id = auth.id_group(role=request.args(0)) 
>> auth.add_membership(group_id, form.vars.id)
>>
>> auth.settings.register_onaccept.append(add_group)
>>
>>
>>
>>
>> On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:
>>>
>>> Sorry, there is one more "but". After renaming the form all goes well, 
>>> except that this piece of code
>>>
>>> if register_form.accepts(request.vars, formname='register'):
>>> auth.add_membership(group_id=1, 
>>> user_id=register_form.vars.id
>>> )
>>>
>>> no longer adds the right membership to user. It gives them the default 
>>> group: user_[id], while earlier adding to "group 1" worked properly.
>>>
>>> On Friday, June 7, 2013 1:11:23 AM UTC+2, Anthony wrote:

 I think the form processing within the auth.register() function is 
 probably failing because you have renamed the form to 's_registration', 
 and 
 it is expecting a form named 'register' (it uses the formname to check the 
 _formkey value in the session). If the form doesn't get accepted, it 
 doesn't get to the redirect logic.

 Anthony

 On Thursday, June 6, 2013 6:59:51 PM UTC-4, lesssugar wrote:
>
> Right, thanks. But what about the "next" attribute? What might be the 
> reason of the argument not working?
>
> On Friday, June 7, 2013 12:53:35 AM UTC+2, Anthony wrote:
>>
>> auth.register() automatically processes the form, so you should not 
>> subsequently call request_form.process().
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 6:21:52 PM UTC-4, lesssugar wrote:
>>>
>>> After user registers, I would like to redirect them to a different 
>>> URL, let's say default/index.
>>>
>>> Auto-login in db.py is set to False.
>>>
>>> In my default.py controller I have this:
>>>
>>> register_form = auth.register(next=URL('default', 'index'))
>>> register_form.update(_class='formstyle', _name='s_registration')
>>> if register_form.process().accepts(request.vars, 
>>> formname='s_registration'):
>>> auth.add_membership(group_id=1, 
>>> user_id=register_form.vars.id
>>> )
>>> 
>>> return dict(register_form=register_form)
>>>
>>> So after user registers, no redirection takes place. However, the 
>>> registration itself is correct (checked auth_user and auth_membership 
>>> in 
>>> the DB).
>>>
>>> Any suggestions why "next" argument does't get the job done?
>>>
>>> UPDATE:
>>> If I add "redirect(URL('default', 'index'))" in the IF condition 
>>> (code above) - all goes fine. What's with the "next" argument then?
>>>
>>>

-- 

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




Re: [web2py] Re: Python 3 compatibility?

2013-06-07 Thread LightDot
On Friday, June 7, 2013 3:36:49 AM UTC+2, Anthony wrote:
>
> For example, I need web2py to provide python 2.6 compatibility for at 
>> least another 5 years. I'm going to need python 2.7 compatibility for at 
>> least another 10 years if not longer.
>
>
> I don't know if your particular application(s) make use of many other 
> Python libraries, but if they do, then you also need those libraries to 
> maintain Python 2 compatibility for the next 10 years (or you have to fork 
> and maintain them yourself, which may work for you). Of course this will 
> vary by application, but in many cases, there will come a point at which it 
> will be easier to port the app code to Python 3 than to try to keep hanging 
> on to Python 2.
>
 
I solve this by using distributions with long term support [1], respins of 
Red Hat. I have customers that opt for Red Hat itself when they don't want 
to let us handle the OS. Current RHEL 6 will be supported until 2023 and 
I'll have to support web2py applications with python 2.6 compatibility at 
least until 2017 if not longer. We guarantee this for our products.

It would be hard for me to justify the price of supporting forked 
libraries. I opt for EPEL [2] packages when I absolutely must and I fork 
something when I'm truly paid to support it, although I personally don't 
like doing it. It's a lot of work if one wants to do it properly.

I'm looking into Red Hat software collections [3] and how these will change 
the support options we could provide... But that's only 3 years of support 
as it stands now.

Also, breaking backward compatibility by merely switching to Python 3 isn't 
> the same as breaking backward compatibility by changing the web2py API. 
> There are tools to automate the process of converting application code from 
> Python 2 to 3 that will get you most of the way. Most of the 
> web2py-specific code would presumably remain unchanged.
>

This is a good point. When Massimo laid out plans for web3py, certain 
web2py compatibility at the app level reassured me that choosing web2py as 
our preferred tool of trade was a good choice.
 

> Anyway, I agree that the ideal would be a web3py that works with both 2.7 
> and 3.x and that runs legacy web2py apps as well.
>

Yea, I imagine it would cover most of the users of web2py. As for me, I 
know RHEL 7 will carry python 2.7.x. It could carry python 3.x too and I 
assume it will, but that's just a guess.

When I started participating in the web2py community, I was pretty 
surprised to see how much Ubuntu gets used for the server/VPS OS of choice. 
I guess current trends demand for short lived app instances. Contemplating 
about using Fedora as deploy / destroy / deploy instance [4] is a good case 
for this trend.

But to be perfectly honest, I don't see how anyone could provide actual 
support in such a volatile environment. I imagine if Dante was writing 
today, there would be a circle in hell where sysadmins would need to 
support environments with forked ruby gems, python libs, etc. for the 
eternity. :)

Regards,
Ales

[1] https://access.redhat.com/support/policy/updates/errata/
[2] http://fedoraproject.org/wiki/EPEL
[3] 
http://www.redhat.com/about/news/archive/2013/6/red-hat-software-collections-1.0-beta-now-available
[4] http://lwn.net/Articles/552800/#Comments

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread Anthony
How do users get to their respective registration URLs to begin with? If 
they are sent a link via email, you could use a digital 
signature. 
If they are allowed to choose the group themselves by making a selection, 
then your current method is fine, but you should still check that 
request.args(0) is limited to only the two allowed groups (so if you have 
an admin group or some other roles with greater restrictions users won't be 
able to assign themselves to those roles).

Anthony

On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:
>
> That's my concern also. I simply would like to make a transparent 
> registration for 2 groups separately. In order to do so I have two 
> different forms generating depending on URL argument: 
> default/register/[group1] or [group2]. Checking request.args(0) on 
> "onaccept" seemed obvious but it needs improvements.
>
> Is it a good idea to check also a specific form id attribute when 
> performing onaccept? How do I check the form id attribute value? Or maybe 
> there's a better way do make sure noone messes with the URL arguments?
>
> On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>>
>> Yes, you should not call .process() after calling auth.register() because 
>> the second time through .process() it will fail (the _formkey token is only 
>> good for one process -- so it fails on the second). Using an onaccept 
>> callback is the way to go. However, it appears you are allowing your users 
>> to assign themselves to any arbitrary group simply by manipulating an arg 
>> in the URL -- that doesn't seem like a good idea.
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:
>>>
>>> OK, I figured out something like this and it works (let me know if it's 
>>> not correct in any way):
>>>
>>> In db.py model:
>>>
>>> auth.settings.create_user_groups = False
>>>
>>> and then
>>>
>>> def add_group(form):
>>> group_id = auth.id_group(role=request.args(0)) 
>>> auth.add_membership(group_id, form.vars.id)
>>>
>>> auth.settings.register_onaccept.append(add_group)
>>>
>>>
>>>
>>>
>>> On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:

 Sorry, there is one more "but". After renaming the form all goes well, 
 except that this piece of code

 if register_form.accepts(request.vars, formname='register'):
 auth.add_membership(group_id=1, 
 user_id=register_form.vars.id
 )

 no longer adds the right membership to user. It gives them the default 
 group: user_[id], while earlier adding to "group 1" worked properly.

 On Friday, June 7, 2013 1:11:23 AM UTC+2, Anthony wrote:
>
> I think the form processing within the auth.register() function is 
> probably failing because you have renamed the form to 's_registration', 
> and 
> it is expecting a form named 'register' (it uses the formname to check 
> the 
> _formkey value in the session). If the form doesn't get accepted, it 
> doesn't get to the redirect logic.
>
> Anthony
>
> On Thursday, June 6, 2013 6:59:51 PM UTC-4, lesssugar wrote:
>>
>> Right, thanks. But what about the "next" attribute? What might be the 
>> reason of the argument not working?
>>
>> On Friday, June 7, 2013 12:53:35 AM UTC+2, Anthony wrote:
>>>
>>> auth.register() automatically processes the form, so you should not 
>>> subsequently call request_form.process().
>>>
>>> Anthony
>>>
>>> On Thursday, June 6, 2013 6:21:52 PM UTC-4, lesssugar wrote:

 After user registers, I would like to redirect them to a different 
 URL, let's say default/index.

 Auto-login in db.py is set to False.

 In my default.py controller I have this:

 register_form = auth.register(next=URL('default', 'index'))
 register_form.update(_class='formstyle', _name='s_registration')
 if register_form.process().accepts(request.vars, 
 formname='s_registration'):
 auth.add_membership(group_id=1, 
 user_id=register_form.vars.id
 )
 
 return dict(register_form=register_form)

 So after user registers, no redirection takes place. However, the 
 registration itself is correct (checked auth_user and auth_membership 
 in 
 the DB).

 Any suggestions why "next" argument does't get the job done?

 UPDATE:
 If I add "redirect(URL('default', 'index'))" in the IF condition 
 (code above) - all goes fine. What's with the "next" argument then?



-- 

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

[web2py] Off Topic - Open source BPM tool?

2013-06-07 Thread António Ramos
hello, just like to know if there is some kind of open source IDE/GUI for
Business Process Management
We have a budget of 0
Thank you
António

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Matt
Can anyone speak to this issue? I'm not sure if I misunderstand the intent 
of current.session, or if this indeed a bug I could help fix.

Thanks,
Matt


On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>
> Hi,
> In one of my modules I'm trying to create a local socket connection that 
> persists across a single session (one socket per one user logged into the 
> system from a given browser), and thought that current.session would give 
> me the info I needed. Specifically, we use a lot of REST calls in our 
> frontend code to populate data for certain elements on the screen and this 
> creates a new session hash for the current.session each time, but the 
> actual session is the same. The only way I've been able to get a key that 
> identifies the session is to run: 
>
> cookies = current.request["cookies"]
> session = cookies["session_id_"].value
>
> Shouldn't some identifier (or even this cookie itself) be available in 
> current.session? Perhaps I misunderstand the point of current.session.
>
> Matt
>
>

-- 

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




[web2py] Re: Problem with smartgrid linked tables: 'Row' object has no attribute 'f_name'

2013-06-07 Thread CrC Nommack
Hi, I have the same problem.
I defined the following tables:

db.define_table('t_questions',
Field('f_question', type='text', label=T('Question')),
Field('f_question_number', type='integer', label=T('Question number')),
Field('f_lecture', type='reference t_activities', label=T('Lecture')),
auth.signature, format='%(f_question)s',
plural="Questions",
migrate=settings.migrate)

db.define_table('t_answers',
Field('f_question', type='reference t_questions', label=T('Question')),
Field('f_option', type='string', label=T('Option')),
Field('f_points', type='integer', label=T('Points')),
Field('f_iscorrect', type='boolean', label=T('Is Correct')),
auth.signature, format='%(f_option)s',
plural="Answers",
migrate=settings.migrate)

and then defined the smartgrid:

questions = SQLFORM.smartgrid(db.t_questions, linked_tables=['t_answers'],
fields = dict(t_questions =(db.t_questions.f_question_number, 
db.t_questions.f_lecture, db.t_questions.f_question)),
field_id = (db.t_questions.id),
orderby = dict(t_questions = 
[db.t_questions.f_lecture|db.t_questions.f_question_number]),#|db.t_questions.f_question_number,
csv = False,
deletable = True,
editable = True,
create = True,
paginate=100 
)

When the smartgrid is displayed I click on edit a question, then in the 
edit page I click on "Answers", it shows the anwers for that question and 
when I click in "View "Edit" or "Delete" it gives me an error: 

AttributeError: 'Row' object has no attribute 'f_option'


That's because those buttons make reference to: 
https://mysite/app/controller/questions/t_questions/t_answers.f_question/6/view/
t_questions/14?_signature=c93a35518f7922dd8e85a6b1dace5b797eb5a394

which is wrong as it must be "t_answers/14"

Any idea?

Thank you very much.
Regards






On Wednesday, May 15, 2013 10:47:53 PM UTC+2, bapster wrote:
>
> *Running on latest web2py v2.4.6 from trunk (but also occurs in Version 
> 2.4.6-stable+timestamp.2013.04.06.17.37.38).*
>
> When traversing linked tables with a smartgrid, the breadcrumbs code in 
> sqlhtml.py is causing an error, due to a mixup of the table/record 
> association.
>
> The problem is easily duplicated by creating a new app with the wizard:
>
>1. Define table: car_type
>   - Field: desc string
>2. Define table: car
>   - Field: name string
>   - Field: car_type_id *reference* car_type
>3. Run the application.
>4. Click the "Car Type" menu link, which invokes SQLFORM.smartgrid for 
>the car_type table.
>5. In the car_type grid, on one of the records, click the "T cars" 
>link. This pulls up a grid for the cars table, filtered for the selected 
>car_type.
>6. In the car grid, click one of the "Car Type Id" links.
>   - This will result in the error:  
>   'Row' object has no attribute 'f_name'
>
> Causing this error is a call to format() in the breadcrumbs code of 
> sqlhtml.py, line 2662. The table argument being referenced for the format 
> string is *car*, but the row argument is a *car_type* record.
>
> Note that I've been working around this issue by specifying my 
> define_table format argument like this (hack):
> format=lambda r: r.get('f_name') or ('#' + str(r.id))
>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Anthony
current.session is just the session object, which is in the web2py global 
environment -- it contains the user's session for the current request. The 
session itself does not include its own ID. If you want the session ID, it 
is in response.session_id (also, current.response.session_id). For file 
based sessions, the filename is in response.session_filename.

Anthony

On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>
> Hi,
> In one of my modules I'm trying to create a local socket connection that 
> persists across a single session (one socket per one user logged into the 
> system from a given browser), and thought that current.session would give 
> me the info I needed. Specifically, we use a lot of REST calls in our 
> frontend code to populate data for certain elements on the screen and this 
> creates a new session hash for the current.session each time, but the 
> actual session is the same. The only way I've been able to get a key that 
> identifies the session is to run: 
>
> cookies = current.request["cookies"]
> session = cookies["session_id_"].value
>
> Shouldn't some identifier (or even this cookie itself) be available in 
> current.session? Perhaps I misunderstand the point of current.session.
>
> Matt
>
>

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread lesssugar
It's pretty straightforward - there are 2 registration links in the menu 
and each of them links to default/register/[group_type]. Then, in the view, 
request.args(0) value is being checked to generate respective form. Guess, 
I'll go for the request.args(0) limitation, as you wrote.

By the way, can I stop (revert?) the registration process when user tries 
to register with non-specified URL argument? Like this:

1. User submits the form
2. onaccept callback checks if the URL argument is equal to one of 2 
specified
3. If not, registration takes no place (new user is not created) and the 
application redirects to a different (error) page

W dniu piątek, 7 czerwca 2013 15:23:00 UTC+2 użytkownik Anthony napisał:
>
> How do users get to their respective registration URLs to begin with? If 
> they are sent a link via email, you could use a digital 
> signature.
>  
> If they are allowed to choose the group themselves by making a selection, 
> then your current method is fine, but you should still check that 
> request.args(0) is limited to only the two allowed groups (so if you have 
> an admin group or some other roles with greater restrictions users won't be 
> able to assign themselves to those roles).
>
> Anthony
>
> On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:
>>
>> That's my concern also. I simply would like to make a transparent 
>> registration for 2 groups separately. In order to do so I have two 
>> different forms generating depending on URL argument: 
>> default/register/[group1] or [group2]. Checking request.args(0) on 
>> "onaccept" seemed obvious but it needs improvements.
>>
>> Is it a good idea to check also a specific form id attribute when 
>> performing onaccept? How do I check the form id attribute value? Or maybe 
>> there's a better way do make sure noone messes with the URL arguments?
>>
>> On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>>>
>>> Yes, you should not call .process() after calling auth.register() 
>>> because the second time through .process() it will fail (the _formkey token 
>>> is only good for one process -- so it fails on the second). Using an 
>>> onaccept callback is the way to go. However, it appears you are allowing 
>>> your users to assign themselves to any arbitrary group simply by 
>>> manipulating an arg in the URL -- that doesn't seem like a good idea.
>>>
>>> Anthony
>>>
>>> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:

 OK, I figured out something like this and it works (let me know if it's 
 not correct in any way):

 In db.py model:

 auth.settings.create_user_groups = False

 and then

 def add_group(form):
 group_id = auth.id_group(role=request.args(0)) 
 auth.add_membership(group_id, form.vars.id)

 auth.settings.register_onaccept.append(add_group)




 On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:
>
> Sorry, there is one more "but". After renaming the form all goes well, 
> except that this piece of code
>
> if register_form.accepts(request.vars, formname='register'):
> auth.add_membership(group_id=1, 
> user_id=register_form.vars.id
> )
>
> no longer adds the right membership to user. It gives them the default 
> group: user_[id], while earlier adding to "group 1" worked properly.
>
> On Friday, June 7, 2013 1:11:23 AM UTC+2, Anthony wrote:
>>
>> I think the form processing within the auth.register() function is 
>> probably failing because you have renamed the form to 's_registration', 
>> and 
>> it is expecting a form named 'register' (it uses the formname to check 
>> the 
>> _formkey value in the session). If the form doesn't get accepted, it 
>> doesn't get to the redirect logic.
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 6:59:51 PM UTC-4, lesssugar wrote:
>>>
>>> Right, thanks. But what about the "next" attribute? What might be 
>>> the reason of the argument not working?
>>>
>>> On Friday, June 7, 2013 12:53:35 AM UTC+2, Anthony wrote:

 auth.register() automatically processes the form, so you should not 
 subsequently call request_form.process().

 Anthony

 On Thursday, June 6, 2013 6:21:52 PM UTC-4, lesssugar wrote:
>
> After user registers, I would like to redirect them to a different 
> URL, let's say default/index.
>
> Auto-login in db.py is set to False.
>
> In my default.py controller I have this:
>
> register_form = auth.register(next=URL('default', 'index'))
> register_form.update(_class='formstyle', _name='s_registration')
> if register_form.process().accepts(request.vars, 
> formname='s_registration'):
> au

[web2py] Re: Nested groups/roles for authorization

2013-06-07 Thread Alfonso E.M.

Reading my post I think I did not explained clearly.

I want to substitute AD, not for login, just as storage for user apps 
profiles and policies. The tool I have in my mind is something like puppet, 
chef, or saltstack, but with a powerful web interface.

AD Is needed at the begining, in order to import all the nested groups of 
users and computers into a web2py managed database.



El jueves, 6 de junio de 2013 18:04:18 UTC+2, Massimo Di Pierro escribió:
>
> The web2py RBAC is flexible but interoperates with AD via LDAP only at the 
> level of authentication. Group and access information are not shared 
> between web2py and LDAP.
>
> On Thursday, 6 June 2013 07:28:38 UTC-5, Alfonso E.M. wrote:
>>
>>
>> Hello!
>>
>> I am planning a system to manage gnu/linux workstations (currently under 
>> Active Directory control).
>>
>> I love to make the control server with web2py but I am not sure if web2py 
>> RBAC implementation can cope with nested groups as Active Directory does.
>>
>> Any clues?
>>
>> Thanks in advance!
>>
>

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread Anthony
Don't check the validity of request.args(0) in the onaccept callback -- 
that's too late. Instead, check it before you even call auth.register().

Anthony

On Friday, June 7, 2013 9:58:09 AM UTC-4, lesssugar wrote:
>
> It's pretty straightforward - there are 2 registration links in the menu 
> and each of them links to default/register/[group_type]. Then, in the view, 
> request.args(0) value is being checked to generate respective form. Guess 
> I'll go for the request.args(0) limitation, as you wrote.
>
> By the way, can I stop (revert?) the registration process when user tries 
> to register with non-specified URL argument? Like this:
>
> 1. User submits the form
> 2. onaccept callback checks if the URL argument is equal to one of 2 
> specified
> 3. If not, registration takes no place (new user is not created) and the 
> application redirects to a different (error) page
>
> W dniu piątek, 7 czerwca 2013 15:23:00 UTC+2 użytkownik Anthony napisał:
>>
>> How do users get to their respective registration URLs to begin with? If 
>> they are sent a link via email, you could use a digital 
>> signature.
>>  
>> If they are allowed to choose the group themselves by making a selection, 
>> then your current method is fine, but you should still check that 
>> request.args(0) is limited to only the two allowed groups (so if you have 
>> an admin group or some other roles with greater restrictions users won't be 
>> able to assign themselves to those roles).
>>
>> Anthony
>>
>> On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:
>>>
>>> That's my concern also. I simply would like to make a transparent 
>>> registration for 2 groups separately. In order to do so I have two 
>>> different forms generating depending on URL argument: 
>>> default/register/[group1] or [group2]. Checking request.args(0) on 
>>> "onaccept" seemed obvious but it needs improvements.
>>>
>>> Is it a good idea to check also a specific form id attribute when 
>>> performing onaccept? How do I check the form id attribute value? Or maybe 
>>> there's a better way do make sure noone messes with the URL arguments?
>>>
>>> On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:

 Yes, you should not call .process() after calling auth.register() 
 because the second time through .process() it will fail (the _formkey 
 token 
 is only good for one process -- so it fails on the second). Using an 
 onaccept callback is the way to go. However, it appears you are allowing 
 your users to assign themselves to any arbitrary group simply by 
 manipulating an arg in the URL -- that doesn't seem like a good idea.

 Anthony

 On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:
>
> OK, I figured out something like this and it works (let me know if 
> it's not correct in any way):
>
> In db.py model:
>
> auth.settings.create_user_groups = False
>
> and then
>
> def add_group(form):
> group_id = auth.id_group(role=request.args(0)) 
> auth.add_membership(group_id, form.vars.id)
>
> auth.settings.register_onaccept.append(add_group)
>
>
>
>
> On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:
>>
>> Sorry, there is one more "but". After renaming the form all goes 
>> well, except that this piece of code
>>
>> if register_form.accepts(request.vars, formname='register'):
>> auth.add_membership(group_id=1, 
>> user_id=register_form.vars.id
>> )
>>
>> no longer adds the right membership to user. It gives them the 
>> default group: user_[id], while earlier adding to "group 1" worked 
>> properly.
>>
>> On Friday, June 7, 2013 1:11:23 AM UTC+2, Anthony wrote:
>>>
>>> I think the form processing within the auth.register() function is 
>>> probably failing because you have renamed the form to 's_registration', 
>>> and 
>>> it is expecting a form named 'register' (it uses the formname to check 
>>> the 
>>> _formkey value in the session). If the form doesn't get accepted, it 
>>> doesn't get to the redirect logic.
>>>
>>> Anthony
>>>
>>> On Thursday, June 6, 2013 6:59:51 PM UTC-4, lesssugar wrote:

 Right, thanks. But what about the "next" attribute? What might be 
 the reason of the argument not working?

 On Friday, June 7, 2013 12:53:35 AM UTC+2, Anthony wrote:
>
> auth.register() automatically processes the form, so you should 
> not subsequently call request_form.process().
>
> Anthony
>
> On Thursday, June 6, 2013 6:21:52 PM UTC-4, lesssugar wrote:
>>
>> After user registers, I would like to redirect them to a 
>> different URL, let's say default/index.
>>
>> Auto-login 

[web2py] web2py in education

2013-06-07 Thread Massimo Di Pierro
Can you please help me

Do you use web2py in a class?
What is your name?
What is your position (teacher, student, etc.)?
What is the instructor name (if not you)?
How was web2py uses (to do a project, as teaching tool, etc.)?
Where is the class taught?
When was is taught (can be a date in the future if you plan to do so)?
What did you like and what did you not like about the class?
Will this class be taught again using web2py?


-- 

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




Re: [web2py] web2py in education

2013-06-07 Thread joseph simpson
I have used Web2py in two classes where I was a student.
The classes were Web Technology Solutions and Professional Open
Source Web Development at the University of Washington in the Professional
and Continuing Education Department.

The instructors vary ...
Web2py was used in my class projects

I talked the instructors into letting me use Web2py so I would not have to
use PHP...

Take care and have fun,

Joe




f


On Fri, Jun 7, 2013 at 7:34 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you please help me
>
> Do you use web2py in a class?
> What is your name?
> What is your position (teacher, student, etc.)?
> What is the instructor name (if not you)?
> How was web2py uses (to do a project, as teaching tool, etc.)?
> Where is the class taught?
> When was is taught (can be a date in the future if you plan to do so)?
> What did you like and what did you not like about the class?
> Will this class be taught again using web2py?
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Joe Simpson

Sent From My DROID!!

-- 

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




[web2py] where is the json data when using GWT's RequestBuilder() ?

2013-06-07 Thread Carl
>From a GWT app I'm calling my Web2py server app.

String jsonData = "{'example' : 'example data'}";
builder.setHeader("Accept", "application/json");
builder.setHeader("Content-type", "application/json");
builder.setHeader("Content-length", Integer.toString(jsonData.length()));
builder.sendRequest(jsonData, new RequestCallback() { ... }

Where in Web2py can I access jsonData?
I've looked thru 'request' but can't locate "example data".



-- 

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




[web2py] Re: current.session

2013-06-07 Thread Matt
On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:

> current.session is just the session object, which is in the web2py global 
> environment -- it contains the user's session for the current request. The 
> session itself does not include its own ID. If you want the session ID, it 
> is in response.session_id (also, current.response.session_id). For file 
> based sessions, the filename is in response.session_filename.
>
> Also, the session cookie name is in response.session_id_name, so to get 
> the session cookie, do request.cookies[response.session_id_name].
>
>
Anthony,
Thanks for the clarification. What I'm really trying to do is to persist an 
object for a given session (a local unix domain socket to an rpc 
interface), but there doesn't seem to be any easy way to do this. 
Specifically, there doesn't seem to be a way for me to determine when a 
session has been closed/deleted in order to clean up the socket. Do you 
know of any way to do this? 

Matt
 

> Anthony
>
> On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>>
>> Hi,
>> In one of my modules I'm trying to create a local socket connection that 
>> persists across a single session (one socket per one user logged into the 
>> system from a given browser), and thought that current.session would give 
>> me the info I needed. Specifically, we use a lot of REST calls in our 
>> frontend code to populate data for certain elements on the screen and this 
>> creates a new session hash for the current.session each time, but the 
>> actual session is the same. The only way I've been able to get a key that 
>> identifies the session is to run: 
>>
>> cookies = current.request["cookies"]
>> session = cookies["session_id_"].value
>>
>> Shouldn't some identifier (or even this cookie itself) be available in 
>> current.session? Perhaps I misunderstand the point of current.session.
>>
>> Matt
>>
>>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Matt


On Friday, June 7, 2013 11:28:48 AM UTC-4, Matt wrote:
>
> On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:
>
>> current.session is just the session object, which is in the web2py global 
>> environment -- it contains the user's session for the current request. The 
>> session itself does not include its own ID. If you want the session ID, it 
>> is in response.session_id (also, current.response.session_id). For file 
>> based sessions, the filename is in response.session_filename.
>>
>> Also, the session cookie name is in response.session_id_name, so to get 
>> the session cookie, do request.cookies[response.session_id_name].
>>
>>
> Anthony,
> Thanks for the clarification. What I'm really trying to do is to persist 
> an object for a given session (a local unix domain socket to an rpc 
> interface), but there doesn't seem to be any easy way to do this. 
> Specifically, there doesn't seem to be a way for me to determine when a 
> session has been closed/deleted in order to clean up the socket. Do you 
> know of any way to do this? 
>
>
As a followup: I thought initially I could just create the object in the 
thread local storage for the current.session, but it seems that this is 
created anew for all requests and responses? 
 

> Matt
>  
>
>> Anthony
>>
>> On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>>>
>>> Hi,
>>> In one of my modules I'm trying to create a local socket connection that 
>>> persists across a single session (one socket per one user logged into the 
>>> system from a given browser), and thought that current.session would give 
>>> me the info I needed. Specifically, we use a lot of REST calls in our 
>>> frontend code to populate data for certain elements on the screen and this 
>>> creates a new session hash for the current.session each time, but the 
>>> actual session is the same. The only way I've been able to get a key that 
>>> identifies the session is to run: 
>>>
>>> cookies = current.request["cookies"]
>>> session = cookies["session_id_"].value
>>>
>>> Shouldn't some identifier (or even this cookie itself) be available in 
>>> current.session? Perhaps I misunderstand the point of current.session.
>>>
>>> Matt
>>>
>>>

-- 

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




[web2py] What is the best (or correct) way to show a reference value

2013-06-07 Thread Relsi Hur Maron
Hi guys, 

I have a doubt here about he best way of show a *reference* value.

I'll use a simple example to illustrate, I have the following tables:


db.define_table('city',
Field('name', type='string')
)
db.define_table('state',
Field('name', type='string')
)
db.define_table('user',
Field('user_name', 'string'),
Field('user_city', 'reference city'),
Field('user_state', 'reference state')
)


When I list the *user* table data in the view, *user_city* and *user_state* 
show their *id's*. It's OK.

So, to display the value of another field, not the Id, I usually do so:

In the controller:


list = db(db.user.id>0).select(
db.user.ALL,
db.state.ALL,
db.state.ALL,
left = [
db.state.on(db.state.id == db.user.user_state),
db.city.on(db.city.id == db.user.user_city)
]
)
return dict(list=list)


And in the view:


{{for data in list:}}

{{=data.user.user_name}}
{{=data.city.name}}
{{=data.state.name}}

{{pass}}

And it works very well, but I discovered here that I can make it in a more 
simple way:

In controller:

list = db(db.user.id >0).select()
return dict(list=list)

In the view:

{{for data in list:}}

{{=data.user_name}}
{{=("%(name)s" %data.user_city)}}
{{=("%(name)s" %data.user_state)}}

{{pass}}

So my question is if I can use this second format, without mounting a join 
as I did in the first example. What is the best (efficient) format? and why?


Thanks to all!!
































-- 

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




[web2py] Error when modifying auth_user table

2013-06-07 Thread Andre Kozaczka
I'm trying to modify the auth_user table and I keep either getting a Table 
'auth_user' already exist error (when migrate=True) OR a 'Column not found' 
(when migrate=False).  Not sure what I need to do.

I've also tried experimenting with fake_migrate but I'm still getting 
either one of those errors.  

Here is my code:
db = DAL(settings.db_uri, pool_size=20)


crud = Crud(globals(), db)
auth = Auth(globals(), db)

auth.settings.actions_disabled.append('register') 
auth.settings.extra_fields['auth_user'] = [Field('eft', 'integer')]

auth.define_tables(migrate=True)


-- 

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




[web2py] Passing Smartgrid vars to Factory

2013-06-07 Thread Alex Glaros
Is it good programming, and is there a way to pass parameters from 
Smartgrid to Factory?

I often need a way to have user locate an already-existing record, which 
works great in Smartgrid, then add children to that one record, which works 
great in Factory.

Can anyone please offer code samples if it’s possible to copy Smartgrid 
record vars to Factory?

Thanks,

Alex Glaros

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread lesssugar

>
> Instead, check it before you even call auth.register().
>

Not sure how to achieve this. It's goes the following way now:

1. The registration view renders. request.args(0) is checked (group1 or 
group2) and respective form generates. At this point the URL argument is OK 
(as user came to registration page by clicking a direct link which 
contained one of the two possible arguments).
2. From this moment the user can do anything with the URL. As the form is 
already generated the point is to check if the URL argument is valid *when 
submitting the form*, isn't it? How can I to do it *before *the 
auth.register() form generetes?

Let me just stress, how new I am to web2py.

On Friday, June 7, 2013 4:24:23 PM UTC+2, Anthony wrote:
>
> Don't check the validity of request.args(0) in the onaccept callback -- 
> that's too late. Instead, check it before you even call auth.register().
>
> Anthony
>
> On Friday, June 7, 2013 9:58:09 AM UTC-4, lesssugar wrote:
>>
>> It's pretty straightforward - there are 2 registration links in the menu 
>> and each of them links to default/register/[group_type]. Then, in the view, 
>> request.args(0) value is being checked to generate respective form. Guess 
>> I'll go for the request.args(0) limitation, as you wrote.
>>
>> By the way, can I stop (revert?) the registration process when user tries 
>> to register with non-specified URL argument? Like this:
>>
>> 1. User submits the form
>> 2. onaccept callback checks if the URL argument is equal to one of 2 
>> specified
>> 3. If not, registration takes no place (new user is not created) and the 
>> application redirects to a different (error) page
>>
>> W dniu piątek, 7 czerwca 2013 15:23:00 UTC+2 użytkownik Anthony napisał:
>>>
>>> How do users get to their respective registration URLs to begin with? If 
>>> they are sent a link via email, you could use a digital 
>>> signature.
>>>  
>>> If they are allowed to choose the group themselves by making a selection, 
>>> then your current method is fine, but you should still check that 
>>> request.args(0) is limited to only the two allowed groups (so if you have 
>>> an admin group or some other roles with greater restrictions users won't be 
>>> able to assign themselves to those roles).
>>>
>>> Anthony
>>>
>>> On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:

 That's my concern also. I simply would like to make a transparent 
 registration for 2 groups separately. In order to do so I have two 
 different forms generating depending on URL argument: 
 default/register/[group1] or [group2]. Checking request.args(0) on 
 "onaccept" seemed obvious but it needs improvements.

 Is it a good idea to check also a specific form id attribute when 
 performing onaccept? How do I check the form id attribute value? Or maybe 
 there's a better way do make sure noone messes with the URL arguments?

 On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>
> Yes, you should not call .process() after calling auth.register() 
> because the second time through .process() it will fail (the _formkey 
> token 
> is only good for one process -- so it fails on the second). Using an 
> onaccept callback is the way to go. However, it appears you are allowing 
> your users to assign themselves to any arbitrary group simply by 
> manipulating an arg in the URL -- that doesn't seem like a good idea.
>
> Anthony
>
> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:
>>
>> OK, I figured out something like this and it works (let me know if 
>> it's not correct in any way):
>>
>> In db.py model:
>>
>> auth.settings.create_user_groups = False
>>
>> and then
>>
>> def add_group(form):
>> group_id = auth.id_group(role=request.args(0)) 
>> auth.add_membership(group_id, form.vars.id)
>>
>> auth.settings.register_onaccept.append(add_group)
>>
>>
>>
>>
>> On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:
>>>
>>> Sorry, there is one more "but". After renaming the form all goes 
>>> well, except that this piece of code
>>>
>>> if register_form.accepts(request.vars, formname='register'):
>>> auth.add_membership(group_id=1, 
>>> user_id=register_form.vars.id
>>> )
>>>
>>> no longer adds the right membership to user. It gives them the 
>>> default group: user_[id], while earlier adding to "group 1" worked 
>>> properly.
>>>
>>> On Friday, June 7, 2013 1:11:23 AM UTC+2, Anthony wrote:

 I think the form processing within the auth.register() function is 
 probably failing because you have renamed the form to 
 's_registration', and 
 it is expecting a form named 'register' (it uses the formname to check 
 th

[web2py] Re: Scheduler task in GAE

2013-06-07 Thread Christian Foster Howes
you may use the taskqueue from inside your controllers or modules.

here's a sample invocation that i used recently:

taskqueue.add(
url=URL(r=request, f=function_to_run),
params={
'created_on':start,
'end':chunk_end,
'prefix':request.vars.prefix or '',
'email_to':request.vars.email_to,
},
method='GET',
)

using additional parameter you can specify which queue to target and how 
long to wait before the task is run.

i also use GAE cron.yaml to schedule the execution of controller methods at 
specified times each day.

On Tuesday, June 4, 2013 3:09:26 AM UTC-7, José Manuel López wrote:
>
> Hi Niphlod, 
> Do you have any example about how use GAE tash queue from web2py?, can I 
> use it inside my main controller without problem?
> something like this:
>
> # Add the task to the default queue.
> taskqueue.add(url='/worker', params={'key': key})
>
>
> I've see this example: 
> https://developers.google.com/appengine/docs/python/taskqueue/overview-pushbut
>  I'm lost about how to use it from my controller and Web2Py. 
> Thanks! 
>
>
> On Monday, June 3, 2013 9:12:14 PM UTC+2, Niphlod wrote:
>>
>> ehmm.. scheduler is NOT meant to be run on GAE. They have task queue 
>> for that.
>>
>> On Monday, June 3, 2013 7:59:45 PM UTC+2, José Manuel López wrote:
>>>
>>> Hi Massimo, 
>>> this is my Web2Py version: Version 
>>> 2.4.6-stable+timestamp.2013.04.06.17.37.38
>>> And I'm running on 2.5 Python version, maybe I've to switch to 2.7?. 
>>>
>>>
>>> On Monday, June 3, 2013 6:56:16 PM UTC+2, Massimo Di Pierro wrote:

 Which web2py version? Which Python version? You may be on an early 
 Python version that does include multiprocessing.

 On Monday, 3 June 2013 11:01:38 UTC-5, José Manuel López wrote:
>
> Hi,
> I've a function call SendReport that send an email to every user in my 
> system every day (morning), something like a newsletter. 
> Now, I've to make this task with the scheduler but I'm not sure how to 
> do it. 
> I've see the video (thanks Massimo), but I'm not sure where I've to do 
> it. 
> This is my code:
>
> Scheduler(db, dict(sendReport=sendReport()))
>
>
> I've done it in a file task.py inside models and inside my main 
> controller... but it's not working it throws me this trace:
>
> ImportError: Cannot import module 'multiprocessing'
>
> What I'm doing wrong?. 
> Thank you for your help!
>
>
>
>
>
>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Cliff Kachinske
You can learn a lot about what's inside the session by adding 
{{=BEAUTIFY(session)}} to the bottom of your main template.  As a rule of 
thumb, anything that can be pickled can go into the session and it does 
persist from request to request.

If anyone new to this stuff reads this post, you only do this on your 
workstation system.

You can also get tripped up by running two instances of your browser, 
because the session remains alive even if you kill the instance where 
you're doing your work.  This is an easy thing to do if you use an OS that 
supports multiple workspaces.

On Friday, June 7, 2013 11:28:48 AM UTC-4, Matt wrote:
>
> On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:
>
>> current.session is just the session object, which is in the web2py global 
>> environment -- it contains the user's session for the current request. The 
>> session itself does not include its own ID. If you want the session ID, it 
>> is in response.session_id (also, current.response.session_id). For file 
>> based sessions, the filename is in response.session_filename.
>>
>> Also, the session cookie name is in response.session_id_name, so to get 
>> the session cookie, do request.cookies[response.session_id_name].
>>
>>
> Anthony,
> Thanks for the clarification. What I'm really trying to do is to persist 
> an object for a given session (a local unix domain socket to an rpc 
> interface), but there doesn't seem to be any easy way to do this. 
> Specifically, there doesn't seem to be a way for me to determine when a 
> session has been closed/deleted in order to clean up the socket. Do you 
> know of any way to do this? 
>
> Matt
>  
>
>> Anthony
>>
>> On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>>>
>>> Hi,
>>> In one of my modules I'm trying to create a local socket connection that 
>>> persists across a single session (one socket per one user logged into the 
>>> system from a given browser), and thought that current.session would give 
>>> me the info I needed. Specifically, we use a lot of REST calls in our 
>>> frontend code to populate data for certain elements on the screen and this 
>>> creates a new session hash for the current.session each time, but the 
>>> actual session is the same. The only way I've been able to get a key that 
>>> identifies the session is to run: 
>>>
>>> cookies = current.request["cookies"]
>>> session = cookies["session_id_"].value
>>>
>>> Shouldn't some identifier (or even this cookie itself) be available in 
>>> current.session? Perhaps I misunderstand the point of current.session.
>>>
>>> Matt
>>>
>>>

-- 

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




[web2py] Re: Problem running web2py with Google Appengine - invalid controller (default/index)

2013-06-07 Thread Christian Foster Howes
if some pages/apps load but some pages give you "invalid controller" i bet 
there is an error in your routing.  check both app.yaml (the GAE specific 
routing) and your web2py routing config.  remember that it's best to 
restart the GAE SDK each time you change app.yaml or a web2py route.

cfh

On Wednesday, June 5, 2013 1:26:57 PM UTC-7, John Drake wrote:
>
> I have been trying for some time now to get an application that I 
> developed using web2py to run on the Google app engine.  I tried to follow 
> the web tutorial here: https://www.youtube.com/watch?v=YZTG2IBMXeU but to 
> no avail.  The web2py welcome page comes up as expected.  But when
> I try to get to my application, or even the built in example applications, 
> I get:
>
> invalid controller (default/index)
>
>
> Everything works fine when I run web2py by itself.  Any ideas?
>

-- 

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




[web2py] SmartGrid acting like SQLFORM.grid

2013-06-07 Thread greenpoise
So yesterday I added a smart grid. It was working fine, today I switched it 
to just grid and it worked..but when I tried to go back to the smartgrid, 
it wont show up the Add button etc..it just shows the search..I deleted the 
cache, restarted web2py, deleted the function, created it under different 
name and nothing. Smartgrid keeps showing as just a search through records. 
It is linked and everything...


grid = 
SQLFORM.smartgrid(db.product,linked_tables=(['series','tyletype','layertype']))
return dict(grid=grid)
code here...

-- 

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




[web2py] Re: Web2py Restful api authentication for android app

2013-06-07 Thread Christian Foster Howes
for my resful APIs i use an oauth library to sign the requests.  i then use 
oauth as my authentication mechanism.

On Wednesday, June 5, 2013 5:29:23 PM UTC-7, Saurabh Kumar wrote:
>
> Hi,
>
> I am writing an android app which has web2py as the server side backend. 
> What are the authentication protocols while using Restful api from Java 
> code. There are two scenarios:
> 1) HTTP (will need something like oauth2.0 )
> 2) HTTPS (can do basic auth)
>
> Which is the best way for authentication in this scenario. Are there any 
> authentication libraries that can help me setup the authentication for 
> restful apis? 
>

-- 

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




Re: [web2py] Re: Web2py Restful api authentication for android app

2013-06-07 Thread Saurabh Kumar
Can you give pointers to the library you are using?

On Fri, Jun 7, 2013 at 11:40 PM, Christian Foster Howes
wrote:

> for my resful APIs i use an oauth library to sign the requests.  i then
> use oauth as my authentication mechanism.
>
>
> On Wednesday, June 5, 2013 5:29:23 PM UTC-7, Saurabh Kumar wrote:
>>
>> Hi,
>>
>> I am writing an android app which has web2py as the server side backend.
>> What are the authentication protocols while using Restful api from Java
>> code. There are two scenarios:
>> 1) HTTP (will need something like oauth2.0 )
>> 2) HTTPS (can do basic auth)
>>
>> Which is the best way for authentication in this scenario. Are there any
>> authentication libraries that can help me setup the authentication for
>> restful apis?
>>
>  --
>
> ---
> 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/i1DJatX4P58/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Matt
On Friday, June 7, 2013 2:03:14 PM UTC-4, Cliff Kachinske wrote:

> You can learn a lot about what's inside the session by adding 
> {{=BEAUTIFY(session)}} to the bottom of your main template.  As a rule of 
> thumb, anything that can be pickled can go into the session and it does 
> persist from request to request.
>
>
Cliff, 
Agreed. you can also just print these variables out in a controller method 
but that definitely works too! I think my confusion came from the naming.. 
one might very easily assume that current.session.id would be the current 
session's id (for instance). also, session_id only exists on the response 
object, not the request which is a bit confusing. 

Either way, it appears that Request, Response and Session are all just sort 
of variable dumping grounds of thread local storage. None of these classes 
seem to give me a way to callback (and delete my object) when the session 
itself has been finished.
 

> If anyone new to this stuff reads this post, you only do this on your 
> workstation system.
>
> You can also get tripped up by running two instances of your browser, 
> because the session remains alive even if you kill the instance where 
> you're doing your work.  This is an easy thing to do if you use an OS that 
> supports multiple workspaces.
>
>
 

> On Friday, June 7, 2013 11:28:48 AM UTC-4, Matt wrote:
>>
>> On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:
>>
>>> current.session is just the session object, which is in the web2py 
>>> global environment -- it contains the user's session for the current 
>>> request. The session itself does not include its own ID. If you want the 
>>> session ID, it is in response.session_id (also, 
>>> current.response.session_id). For file based sessions, the filename is in 
>>> response.session_filename.
>>>
>>> Also, the session cookie name is in response.session_id_name, so to get 
>>> the session cookie, do request.cookies[response.session_id_name].
>>>
>>>
>> Anthony,
>> Thanks for the clarification. What I'm really trying to do is to persist 
>> an object for a given session (a local unix domain socket to an rpc 
>> interface), but there doesn't seem to be any easy way to do this. 
>> Specifically, there doesn't seem to be a way for me to determine when a 
>> session has been closed/deleted in order to clean up the socket. Do you 
>> know of any way to do this? 
>>
>> Matt
>>  
>>
>>> Anthony
>>>
>>> On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:

 Hi,
 In one of my modules I'm trying to create a local socket connection 
 that persists across a single session (one socket per one user logged into 
 the system from a given browser), and thought that current.session would 
 give me the info I needed. Specifically, we use a lot of REST calls in our 
 frontend code to populate data for certain elements on the screen and this 
 creates a new session hash for the current.session each time, but the 
 actual session is the same. The only way I've been able to get a key that 
 identifies the session is to run: 

 cookies = current.request["cookies"]
 session = cookies["session_id_"].value

 Shouldn't some identifier (or even this cookie itself) be available in 
 current.session? Perhaps I misunderstand the point of current.session.

 Matt



-- 

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




Re: [web2py] Re: Web2py Restful api authentication for android app

2013-06-07 Thread Christian Foster Howes
we are using a modified form of 
https://github.com/simplegeo/python-oauth2  modified to make it run on 
GAE and also some tweaks in usage to handle some special-case requirements.


cfh

On 6/7/13 11:26 , Saurabh Kumar wrote:

Can you give pointers to the library you are using?

On Fri, Jun 7, 2013 at 11:40 PM, Christian Foster Howes
wrote:


for my resful APIs i use an oauth library to sign the requests.  i then
use oauth as my authentication mechanism.


On Wednesday, June 5, 2013 5:29:23 PM UTC-7, Saurabh Kumar wrote:


Hi,

I am writing an android app which has web2py as the server side backend.
What are the authentication protocols while using Restful api from Java
code. There are two scenarios:
1) HTTP (will need something like oauth2.0 )
2) HTTPS (can do basic auth)

Which is the best way for authentication in this scenario. Are there any
authentication libraries that can help me setup the authentication for
restful apis?


  --

---
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/i1DJatX4P58/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.







--

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

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




[web2py] Re: Error when modifying auth_user table

2013-06-07 Thread Niphlod
The "column not found" is your "eft" one ?
You code seems legit (setting migrate=True on the define_tables() 
function). We need to see the errors and the definition that causes them.

On Friday, June 7, 2013 7:29:12 PM UTC+2, Andre Kozaczka wrote:
>
> I'm trying to modify the auth_user table and I keep either getting a Table 
> 'auth_user' already exist error (when migrate=True) OR a 'Column not found' 
> (when migrate=False).  Not sure what I need to do.
>
> I've also tried experimenting with fake_migrate but I'm still getting 
> either one of those errors.  
>
> Here is my code:
> db = DAL(settings.db_uri, pool_size=20)
>
>
> crud = Crud(globals(), db)
> auth = Auth(globals(), db)
>
> auth.settings.actions_disabled.append('register') 
> auth.settings.extra_fields['auth_user'] = [Field('eft', 'integer')]
>
> auth.define_tables(migrate=True)
>
>
>

-- 

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




Re: [web2py] Re: Web2py Restful api authentication for android app

2013-06-07 Thread Saurabh Kumar
Thanks :)

On Sat, Jun 8, 2013 at 12:36 AM, Christian Foster Howes
wrote:

> we are using a modified form of https://github.com/simplegeo/**
> python-oauth2   modified to
> make it run on GAE and also some tweaks in usage to handle some
> special-case requirements.
>
> cfh
>
>
> On 6/7/13 11:26 , Saurabh Kumar wrote:
>
>> Can you give pointers to the library you are using?
>>
>> On Fri, Jun 7, 2013 at 11:40 PM, Christian Foster Howes
>> wrote:
>>
>>  for my resful APIs i use an oauth library to sign the requests.  i then
>>> use oauth as my authentication mechanism.
>>>
>>>
>>> On Wednesday, June 5, 2013 5:29:23 PM UTC-7, Saurabh Kumar wrote:
>>>

 Hi,

 I am writing an android app which has web2py as the server side backend.
 What are the authentication protocols while using Restful api from Java
 code. There are two scenarios:
 1) HTTP (will need something like oauth2.0 )
 2) HTTPS (can do basic auth)

 Which is the best way for authentication in this scenario. Are there any
 authentication libraries that can help me setup the authentication for
 restful apis?

--
>>>
>>> ---
>>> 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/i1DJatX4P58/**
>>> unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscribe@**googlegroups.com
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>>
>>

-- 

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




[web2py] Re: What is the best (or correct) way to show a reference value

2013-06-07 Thread Niphlod
the first is more efficient, cause it does a single query. web2py allows to 
fetch "connected" records for each row, but is forced to fetch them one at 
a time. Inspect with response.toolbar queries and timings and choose your 
own poison (hefty query vs "speedier to code")

On Friday, June 7, 2013 6:41:05 PM UTC+2, Relsi Hur Maron wrote:
>
> Hi guys, 
>
> I have a doubt here about he best way of show a *reference* value.
>
> I'll use a simple example to illustrate, I have the following tables:
>
>
> db.define_table('city',
> Field('name', type='string')
> )
> db.define_table('state',
> Field('name', type='string')
> )
> db.define_table('user',
> Field('user_name', 'string'),
> Field('user_city', 'reference city'),
> Field('user_state', 'reference state')
> )
>
>
> When I list the *user* table data in the view, *user_city* and *user_state
> * show their *id's*. It's OK.
>
> So, to display the value of another field, not the Id, I usually do so:
>
> In the controller:
>
>
> list = db(db.user.id>0).select(
> db.user.ALL,
> db.state.ALL,
> db.state.ALL,
> left = [
> db.state.on(db.state.id == db.user.user_state),
> db.city.on(db.city.id == db.user.user_city)
> ]
> )
> return dict(list=list)
>
>
> And in the view:
>
>
> {{for data in list:}}
> 
> {{=data.user.user_name}}
> {{=data.city.name}}
> {{=data.state.name}}
> 
> {{pass}}
>
> And it works very well, but I discovered here that I can make it in a more 
> simple way:
>
> In controller:
>
> list = db(db.user.id >0).select()
> return dict(list=list)
>
> In the view:
>
> {{for data in list:}}
> 
> {{=data.user_name}}
> {{=("%(name)s" %data.user_city)}}
> {{=("%(name)s" %data.user_state)}}
> 
> {{pass}}
>
> So my question is if I can use this second format, without mounting a join 
> as I did in the first example. What is the best (efficient) format? and why?
>
>
> Thanks to all!!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

-- 

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




[web2py] Re: where is the json data when using GWT's RequestBuilder() ?

2013-06-07 Thread Niphlod
if you're using recent web2py releases, that are able to parse POST vars 
encoded in json, you should have them in request.vars as usual. Otherwise, 
see response.body.read() 

On Friday, June 7, 2013 5:24:44 PM UTC+2, Carl wrote:
>
> From a GWT app I'm calling my Web2py server app.
>
> String jsonData = "{'example' : 'example data'}";
> builder.setHeader("Accept", "application/json");
> builder.setHeader("Content-type", "application/json");
> builder.setHeader("Content-length", Integer.toString(jsonData.length()));
> builder.sendRequest(jsonData, new RequestCallback() { ... }
>
> Where in Web2py can I access jsonData?
> I've looked thru 'request' but can't locate "example data".
>
>
>
>

-- 

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




[web2py] Re: web2py_component with helper A(cid=request.cid) and LOAD()

2013-06-07 Thread Niphlod
as soon as the profile page is accessed, 
TypeError: $(...).mask is not a function
http://127.0.0.1:8000/phone/static/js/jquery.js/eval/seq/7
Line 2
remove the line calling the mask plugin that you don't have, it works all 
fine (seems to, at least)!

On Friday, June 7, 2013 4:46:51 PM UTC+2, Charles Levesque wrote:
>
> Here you go. That's a small part of my application. Juste sign in as 
> charles.leves...@gmail.com/12345 and go to the profile page. The 
> component is the list of phone numbers. When you click on the normal edit 
> button next to "Working edit", it doesn't work. It is a button created with 
> the A helper like the one in your example. If you click on the "Working 
> edit" button, it calls web2py_component_custom() in a the file 
> custom_web2py.js where I pasted the original web2py_component() function 
> and simply removed the jQuery(function(){ line. That way, it works. The 
> component reloads.
>
> I also tried your example to see if it was my web2py that was missing a 
> file or something, but it worked perfectly as you said.
>
> In the default controller, don't mind the "if request.args(0)=='view':" 
> part.
>
> Charles
>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Anthony
If the session changes during the request, it gets pickled at the end of 
every request and stored in the session file (or db or cookie if using db 
or cookie based sessions). At the beginning of each request, the session is 
read from the file (or db or cookie) and unpickled. Anything that can't be 
pickled can't be stored in the session.

Anthony

On Friday, June 7, 2013 11:56:19 AM UTC-4, Matt wrote:
>
>
>
> On Friday, June 7, 2013 11:28:48 AM UTC-4, Matt wrote:
>>
>> On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:
>>
>>> current.session is just the session object, which is in the web2py 
>>> global environment -- it contains the user's session for the current 
>>> request. The session itself does not include its own ID. If you want the 
>>> session ID, it is in response.session_id (also, 
>>> current.response.session_id). For file based sessions, the filename is in 
>>> response.session_filename.
>>>
>>> Also, the session cookie name is in response.session_id_name, so to get 
>>> the session cookie, do request.cookies[response.session_id_name].
>>>
>>>
>> Anthony,
>> Thanks for the clarification. What I'm really trying to do is to persist 
>> an object for a given session (a local unix domain socket to an rpc 
>> interface), but there doesn't seem to be any easy way to do this. 
>> Specifically, there doesn't seem to be a way for me to determine when a 
>> session has been closed/deleted in order to clean up the socket. Do you 
>> know of any way to do this? 
>>
>>
> As a followup: I thought initially I could just create the object in the 
> thread local storage for the current.session, but it seems that this is 
> created anew for all requests and responses? 
>  
>
>> Matt
>>  
>>
>>> Anthony
>>>
>>> On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:

 Hi,
 In one of my modules I'm trying to create a local socket connection 
 that persists across a single session (one socket per one user logged into 
 the system from a given browser), and thought that current.session would 
 give me the info I needed. Specifically, we use a lot of REST calls in our 
 frontend code to populate data for certain elements on the screen and this 
 creates a new session hash for the current.session each time, but the 
 actual session is the same. The only way I've been able to get a key that 
 identifies the session is to run: 

 cookies = current.request["cookies"]
 session = cookies["session_id_"].value

 Shouldn't some identifier (or even this cookie itself) be available in 
 current.session? Perhaps I misunderstand the point of current.session.

 Matt



-- 

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




[web2py] Re: What is the best (or correct) way to show a reference value

2013-06-07 Thread Anthony

>
> {{for data in list:}}


> {{=data.user_name}}
> {{=("%(name)s" %data.user_city)}}
> {{=("%(name)s" %data.user_state)}}


Above, '%(name)s' % data.user_city results in data.user_city.name being 
filled into the string. data.user_city is a DAL Reference object -- it 
stores the ID of the referenced record, but when you do data.user_city.name, 
it does a recursive 
selectand 
retrieves the value in the "name" field of the referenced record. So, 
the above code will result in two additional db selects for every record in 
"list". If there are a lot of records, you might want to go with the join 
method, which just does a single select.

Anthony

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Matt


On Friday, June 7, 2013 3:23:02 PM UTC-4, Anthony wrote:
>
> If the session changes during the request, it gets pickled at the end of 
> every request and stored in the session file (or db or cookie if using db 
> or cookie based sessions). At the beginning of each request, the session is 
> read from the file (or db or cookie) and unpickled. Anything that can't be 
> pickled can't be stored in the session.
>
>
Well it's not so much that I want to store something in the session itself. 
Here is my problem specifically:

We use a unix domain socket in some of our controllers to grab data via rpc 
from another process. Currently, we have to create a new socket connection 
for each request, but I would like to reuse the socket and have one socket 
per one actual person making the requests (hence session). This works just 
fine, however, I don't know when the socket is no longer necessary (ie. the 
user logs out). At this point I think my only option is to setup a timer 
that just closes the socket after a set timeout period, because there is no 
callback to tell when the session is over.


 

> Anthony
>
> On Friday, June 7, 2013 11:56:19 AM UTC-4, Matt wrote:
>>
>>
>>
>> On Friday, June 7, 2013 11:28:48 AM UTC-4, Matt wrote:
>>>
>>> On Friday, June 7, 2013 9:53:42 AM UTC-4, Anthony wrote:
>>>
 current.session is just the session object, which is in the web2py 
 global environment -- it contains the user's session for the current 
 request. The session itself does not include its own ID. If you want the 
 session ID, it is in response.session_id (also, 
 current.response.session_id). For file based sessions, the filename is in 
 response.session_filename.

 Also, the session cookie name is in response.session_id_name, so to get 
 the session cookie, do request.cookies[response.session_id_name].


>>> Anthony,
>>> Thanks for the clarification. What I'm really trying to do is to persist 
>>> an object for a given session (a local unix domain socket to an rpc 
>>> interface), but there doesn't seem to be any easy way to do this. 
>>> Specifically, there doesn't seem to be a way for me to determine when a 
>>> session has been closed/deleted in order to clean up the socket. Do you 
>>> know of any way to do this? 
>>>
>>>
>> As a followup: I thought initially I could just create the object in the 
>> thread local storage for the current.session, but it seems that this is 
>> created anew for all requests and responses? 
>>  
>>
>>> Matt
>>>  
>>>
 Anthony

 On Tuesday, June 4, 2013 8:35:06 AM UTC-4, Matt wrote:
>
> Hi,
> In one of my modules I'm trying to create a local socket connection 
> that persists across a single session (one socket per one user logged 
> into 
> the system from a given browser), and thought that current.session would 
> give me the info I needed. Specifically, we use a lot of REST calls in 
> our 
> frontend code to populate data for certain elements on the screen and 
> this 
> creates a new session hash for the current.session each time, but the 
> actual session is the same. The only way I've been able to get a key that 
> identifies the session is to run: 
>
> cookies = current.request["cookies"]
> session = cookies["session_id_"].value
>
> Shouldn't some identifier (or even this cookie itself) be available in 
> current.session? Perhaps I misunderstand the point of current.session.
>
> Matt
>
>

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread Anthony
def register():
if not request.args(0) in [list, of, valid, groups]:
 [redirect somewhere or return an error message]
[rest of your registration code]

Anthony

On Friday, June 7, 2013 1:52:57 PM UTC-4, lesssugar wrote:
>
> Instead, check it before you even call auth.register().
>>
>
> Not sure how to achieve this. It goes the following way now:
>
> 1. The registration view renders. request.args(0) is checked (group1 or 
> group2) and respective form generates. At this point the URL argument is OK 
> (as user came to registration page by clicking a direct link which 
> contained one of the two possible arguments).
> 2. From this moment the user can do anything with the URL. As the form is 
> already generated the point is to check if the URL argument is valid *when 
> submitting the form*, isn't it? How can I to do it *before *the 
> auth.register() form generetes?
>
> Let me just stress, how new I am to web2py.
>
> On Friday, June 7, 2013 4:24:23 PM UTC+2, Anthony wrote:
>>
>> Don't check the validity of request.args(0) in the onaccept callback -- 
>> that's too late. Instead, check it before you even call auth.register().
>>
>> Anthony
>>
>> On Friday, June 7, 2013 9:58:09 AM UTC-4, lesssugar wrote:
>>>
>>> It's pretty straightforward - there are 2 registration links in the menu 
>>> and each of them links to default/register/[group_type]. Then, in the view, 
>>> request.args(0) value is being checked to generate respective form. Guess 
>>> I'll go for the request.args(0) limitation, as you wrote.
>>>
>>> By the way, can I stop (revert?) the registration process when user 
>>> tries to register with non-specified URL argument? Like this:
>>>
>>> 1. User submits the form
>>> 2. onaccept callback checks if the URL argument is equal to one of 2 
>>> specified
>>> 3. If not, registration takes no place (new user is not created) and the 
>>> application redirects to a different (error) page
>>>
>>> W dniu piątek, 7 czerwca 2013 15:23:00 UTC+2 użytkownik Anthony napisał:

 How do users get to their respective registration URLs to begin with? 
 If they are sent a link via email, you could use a digital 
 signature.
  
 If they are allowed to choose the group themselves by making a selection, 
 then your current method is fine, but you should still check that 
 request.args(0) is limited to only the two allowed groups (so if you have 
 an admin group or some other roles with greater restrictions users won't 
 be 
 able to assign themselves to those roles).

 Anthony

 On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:
>
> That's my concern also. I simply would like to make a transparent 
> registration for 2 groups separately. In order to do so I have two 
> different forms generating depending on URL argument: 
> default/register/[group1] or [group2]. Checking request.args(0) on 
> "onaccept" seemed obvious but it needs improvements.
>
> Is it a good idea to check also a specific form id attribute when 
> performing onaccept? How do I check the form id attribute value? Or maybe 
> there's a better way do make sure noone messes with the URL arguments?
>
> On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>>
>> Yes, you should not call .process() after calling auth.register() 
>> because the second time through .process() it will fail (the _formkey 
>> token 
>> is only good for one process -- so it fails on the second). Using an 
>> onaccept callback is the way to go. However, it appears you are allowing 
>> your users to assign themselves to any arbitrary group simply by 
>> manipulating an arg in the URL -- that doesn't seem like a good idea.
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:
>>>
>>> OK, I figured out something like this and it works (let me know if 
>>> it's not correct in any way):
>>>
>>> In db.py model:
>>>
>>> auth.settings.create_user_groups = False
>>>
>>> and then
>>>
>>> def add_group(form):
>>> group_id = auth.id_group(role=request.args(0)) 
>>> auth.add_membership(group_id, form.vars.id)
>>>
>>> auth.settings.register_onaccept.append(add_group)
>>>
>>>
>>>
>>>
>>> On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:

 Sorry, there is one more "but". After renaming the form all goes 
 well, except that this piece of code

 if register_form.accepts(request.vars, formname='register'):
 auth.add_membership(group_id=1, 
 user_id=register_form.vars.id
 )

 no longer adds the right membership to user. It gives them the 
 default group: user_[id], while earlier adding to "group 1" worked 
>>>

[web2py] Re: What is the best (or correct) way to show a reference value

2013-06-07 Thread Relsi Hur Maron

Great! Thank you very much guys. =)



Em sexta-feira, 7 de junho de 2013 16h29min55s UTC-3, Anthony escreveu:
>
> {{for data in list:}}
>
> 
>> {{=data.user_name}}
>> {{=("%(name)s" %data.user_city)}}
>> {{=("%(name)s" %data.user_state)}}
>
>
> Above, '%(name)s' % data.user_city results in data.user_city.name being 
> filled into the string. data.user_city is a DAL Reference object -- it 
> stores the ID of the referenced record, but when you do 
> data.user_city.name, it does a recursive 
> selectand 
> retrieves the value in the "name" field of the referenced record. So, 
> the above code will result in two additional db selects for every record in 
> "list". If there are a lot of records, you might want to go with the join 
> method, which just does a single select.
>
> Anthony
>

-- 

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




[web2py] Re: current.session

2013-06-07 Thread LightDot
On Friday, June 7, 2013 8:58:46 PM UTC+2, Matt wrote:
>
> Either way, it appears that Request, Response and Session are all just 
> sort of variable dumping grounds of thread local storage. None of these 
> classes seem to give me a way to callback (and delete my object) when the 
> session itself has been finished.
>

You can delete the server side session file (file storage is the default). 
There are also handy scripts around that delete them trough cron tasks, 
admin includes one.

You should be able to give the session cookie an expiration time, thus 
changing it into an ordinary cookie and effectively making the browser 
delete it by setting the expiration time the past. Hm, come to think of it, 
I haven't tried this yet.

Regards,
Ales

-- 

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




[web2py] Re: current.session

2013-06-07 Thread Anthony
Indeed, you have no way of knowing when the session has ended on the server 
because the session ends only when the user no longer has a session cookie 
to keep sending back from the browser (so, typically when the browser 
closes or the user manually deletes the session cookie). So yes, you 
probably want to set some kind of expiration or timeout (maybe if a 
particular session has not been active for some period of time, you can 
then close its socket).

Anthony

On Friday, June 7, 2013 3:23:02 PM UTC-4, Anthony wrote:
>>
>> If the session changes during the request, it gets pickled at the end of 
>> every request and stored in the session file (or db or cookie if using db 
>> or cookie based sessions). At the beginning of each request, the session is 
>> read from the file (or db or cookie) and unpickled. Anything that can't be 
>> pickled can't be stored in the session.
>>
>>
> Well it's not so much that I want to store something in the session 
> itself. Here is my problem specifically:
>
> We use a unix domain socket in some of our controllers to grab data via 
> rpc from another process. Currently, we have to create a new socket 
> connection for each request, but I would like to reuse the socket and have 
> one socket per one actual person making the requests (hence session). This 
> works just fine, however, I don't know when the socket is no longer 
> necessary (ie. the user logs out). At this point I think my only option is 
> to setup a timer that just closes the socket after a set timeout period, 
> because there is no callback to tell when the session is over.
>

-- 

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




[web2py] changing class of a custom form not working

2013-06-07 Thread André Kablu
Hi all,

I am trying to change a class of a field using form.element on my user.html 
view:

{{=form.custom.begin}}
Name: {{
  form.element('input',_name='first_name')['_class']='input-medium'
  =form.custom.widget.first_name
}}
{{=form.custom.end}}


It changes the HTML on the source code:
Name:


but does not change the page.

I already tried to remove all classes setting _class to '', and then using 
_size to change the size of the field. Nothing happen too... 

seems like the web2py default CSS is changing the input{text} css patterns 
and nothing we can do to change field class properties

Any ideas?

Thank you very much!

-- 

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




Re: [web2py] is there a dicateded request something to verify if a function get call by a browser?

2013-06-07 Thread Richard Vézina
Wasn't know about sheme=True, that's exactly what was the problem

Thank you Anthony, it is really appreciate.

Richard


On Thu, Jun 6, 2013 at 5:31 PM, Anthony  wrote:

> What is the problem with the A() helper? Is it that the URL is a relative
> URL rather than an absolute URL? If you need an absolute URL, you can do:
>
> A('myrepresent', _href=URL(..., scheme=True))
>
> If that's the issue, the leaving scheme=True will work in both cases, so
> you don't necessarily need to check where the call is coming from, but if
> you want, you can do:
>
> def normal_page_function():
> table = db(db.atable.id>0).select()
>
> db.atable.oneofmyfields.represent = lambda value, record: A(
> 'myrepresent',
> _href=URL(..., scheme=request.function != 'normal_page_function'))
>
> That simply checks whether request.function is the normal_page_function,
> and if not, it sets "scheme" to True.
>
> Anthony
>
> On Thursday, June 6, 2013 5:05:12 PM UTC-4, Richard wrote:
>
>> Hello,
>>
>> I found my self need to check if a function is call by browser or is call
>> internally by an other function...
>>
>> I want to re-use a function in a weekly email sent automatically and want
>> my code to be as DRY as possible...
>>
>> Until now, I have something like this :
>>
>> def normal_page_function():
>> table = db(db.atable.id>0).select()
>> db.atable.oneofmyfield.**represent = lambda value, record:
>> A('myrepresent',_href...)
>> html_table = SQLTABLE(table, ...)
>> return dict(html_table=html_table)
>>
>> def send_page_function():
>> mail.send(to=['te...@test.com']**,
>> reply_to='te...@test.com',
>> subject='subject',
>> message="""%(html_table)**s"""
>> %normal_page_function())
>>
>> But, it produces issue because the A() helper can be processed...
>>
>> So, my idea is to make this littler change :
>>
>> def normal_page_function():
>> table = db(db.atable.id>0).select()
>>* if request.IS_NOT_FROM_BROWSER:*
>> *db.atable.oneofmyfield.represent = lambda value, record:
>> A('myrepresent',_href...)*
>> *else:*
>> *db.atable.oneofmyfield.represent = lambda value, record:
>> 'myrepresent'*
>> html_table = SQLTABLE(table, ...)
>> return dict(html_table=html_table)
>>
>> I think I can get the same result checking into request.http_user_agent
>> and if it empty I know that the request is not comming from browser, but I
>> am not sure it works and would know if there is not already a
>> request.variable_name for that purpose...
>>
>> Thanks
>>
>> Richard
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




Re: [web2py] boolean_widget

2013-06-07 Thread Tim Richardson
Note that the validator to enforce selection (perhaps it is a "accept terms 
and conditions" field) is


requires=IS_IN_SET(['on'])


-- 

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




[web2py] Re: changing class of a custom form not working

2013-06-07 Thread André Kablu
one more information...
if I put on my html file a html code like this:


it also does not change the css effect to the correct class "input-small"


Em sexta-feira, 7 de junho de 2013 16h51min36s UTC-3, André Kablu escreveu:
>
> Hi all,
>
> I am trying to change a class of a field using form.element on my 
> user.html view:
>
> {{=form.custom.begin}}
> Name: {{
>   form.element('input',_name='first_name')['_class']='input-medium'
>   =form.custom.widget.first_name
> }}
> {{=form.custom.end}}
>
>
> It changes the HTML on the source code:
> Name:
>  name="first_name">
>
> but does not change the page.
>
> I already tried to remove all classes setting _class to '', and then using 
> _size to change the size of the field. Nothing happen too... 
>
> seems like the web2py default CSS is changing the input{text} css patterns 
> and nothing we can do to change field class properties
>
> Any ideas?
>
> Thank you very much!
>

-- 

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




[web2py] Re: changing class of a custom form not working

2013-06-07 Thread André Kablu
found, in web2py.css there is a code:

input[type="text"], input[type="password"], select {
margin-right: 5px;
width: 300px;
}


now the question is:
if we want to customize fields size do we need to remove this from 
web2py.css. Is it a bug or the correct behavior of web2py.css?

Thanks!



Em sexta-feira, 7 de junho de 2013 17h02min25s UTC-3, André Kablu escreveu:
>
> one more information...
> if I put on my html file a html code like this:
> 
>
> it also does not change the css effect to the correct class "input-small"
>
>
> Em sexta-feira, 7 de junho de 2013 16h51min36s UTC-3, André Kablu escreveu:
>>
>> Hi all,
>>
>> I am trying to change a class of a field using form.element on my 
>> user.html view:
>>
>> {{=form.custom.begin}}
>> Name: {{
>>   form.element('input',_name='first_name')['_class']='input-medium'
>>   =form.custom.widget.first_name
>> }}
>> {{=form.custom.end}}
>>
>>
>> It changes the HTML on the source code:
>> Name:
>> > name="first_name">
>>
>> but does not change the page.
>>
>> I already tried to remove all classes setting _class to '', and then 
>> using _size to change the size of the field. Nothing happen too... 
>>
>> seems like the web2py default CSS is changing the input{text} css 
>> patterns and nothing we can do to change field class properties
>>
>> Any ideas?
>>
>> Thank you very much!
>>
>

-- 

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




[web2py] Re: web2py_component with helper A(cid=request.cid) and LOAD()

2013-06-07 Thread Charles Levesque
It's working on your side? I'll be damned =P. I'll download another web2py 
and reinstall my app on it, hopping that it'll work. It must be when I 
updated web2py before playing with components.

Thanks for your time and support.

Much appreciated.

-- 

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




[web2py] Re: redirect after registration issue

2013-06-07 Thread lesssugar
Yep. This was embarrassingly simple. Thanks for help and patience.

On Friday, June 7, 2013 9:34:28 PM UTC+2, Anthony wrote:
>
> def register():
> if not request.args(0) in [list, of, valid, groups]:
>  [redirect somewhere or return an error message]
> [rest of your registration code]
>
> Anthony
>
> On Friday, June 7, 2013 1:52:57 PM UTC-4, lesssugar wrote:
>>
>> Instead, check it before you even call auth.register().
>>>
>>
>> Not sure how to achieve this. It goes the following way now:
>>
>> 1. The registration view renders. request.args(0) is checked (group1 or 
>> group2) and respective form generates. At this point the URL argument is OK 
>> (as user came to registration page by clicking a direct link which 
>> contained one of the two possible arguments).
>> 2. From this moment the user can do anything with the URL. As the form is 
>> already generated the point is to check if the URL argument is valid *when 
>> submitting the form*, isn't it? How can I to do it *before *the 
>> auth.register() form generetes?
>>
>> Let me just stress, how new I am to web2py.
>>
>> On Friday, June 7, 2013 4:24:23 PM UTC+2, Anthony wrote:
>>>
>>> Don't check the validity of request.args(0) in the onaccept callback -- 
>>> that's too late. Instead, check it before you even call auth.register().
>>>
>>> Anthony
>>>
>>> On Friday, June 7, 2013 9:58:09 AM UTC-4, lesssugar wrote:

 It's pretty straightforward - there are 2 registration links in the 
 menu and each of them links to default/register/[group_type]. Then, in the 
 view, request.args(0) value is being checked to generate respective form. 
 Guess I'll go for the request.args(0) limitation, as you wrote.

 By the way, can I stop (revert?) the registration process when user 
 tries to register with non-specified URL argument? Like this:

 1. User submits the form
 2. onaccept callback checks if the URL argument is equal to one of 2 
 specified
 3. If not, registration takes no place (new user is not created) and 
 the application redirects to a different (error) page

 W dniu piątek, 7 czerwca 2013 15:23:00 UTC+2 użytkownik Anthony napisał:
>
> How do users get to their respective registration URLs to begin with? 
> If they are sent a link via email, you could use a digital 
> signature.
>  
> If they are allowed to choose the group themselves by making a selection, 
> then your current method is fine, but you should still check that 
> request.args(0) is limited to only the two allowed groups (so if you have 
> an admin group or some other roles with greater restrictions users won't 
> be 
> able to assign themselves to those roles).
>
> Anthony
>
> On Friday, June 7, 2013 6:39:56 AM UTC-4, lesssugar wrote:
>>
>> That's my concern also. I simply would like to make a transparent 
>> registration for 2 groups separately. In order to do so I have two 
>> different forms generating depending on URL argument: 
>> default/register/[group1] or [group2]. Checking request.args(0) on 
>> "onaccept" seemed obvious but it needs improvements.
>>
>> Is it a good idea to check also a specific form id attribute when 
>> performing onaccept? How do I check the form id attribute value? Or 
>> maybe 
>> there's a better way do make sure noone messes with the URL arguments?
>>
>> On Friday, June 7, 2013 3:18:29 AM UTC+2, Anthony wrote:
>>>
>>> Yes, you should not call .process() after calling auth.register() 
>>> because the second time through .process() it will fail (the _formkey 
>>> token 
>>> is only good for one process -- so it fails on the second). Using an 
>>> onaccept callback is the way to go. However, it appears you are 
>>> allowing 
>>> your users to assign themselves to any arbitrary group simply by 
>>> manipulating an arg in the URL -- that doesn't seem like a good idea.
>>>
>>> Anthony
>>>
>>> On Thursday, June 6, 2013 7:56:56 PM UTC-4, lesssugar wrote:

 OK, I figured out something like this and it works (let me know if 
 it's not correct in any way):

 In db.py model:

 auth.settings.create_user_groups = False

 and then

 def add_group(form):
 group_id = auth.id_group(role=request.args(0)) 
 auth.add_membership(group_id, form.vars.id)

 auth.settings.register_onaccept.append(add_group)




 On Friday, June 7, 2013 1:35:41 AM UTC+2, lesssugar wrote:
>
> Sorry, there is one more "but". After renaming the form all goes 
> well, except that this piece of code
>
> if register_form.accepts(request.vars, formname='register'):
> auth.add_membersh

[web2py] Re: Eclipse and autocomplete

2013-06-07 Thread Tim Richardson
This is what I'm doing with eclipse and pydev 2.7.5 


this code snippet at the top of files:

if False:  #this block helps eclipse
import gluon
from gluon import *
from db import *  #repeat for all models
from menu import *

and added the web2py directory to PyDev System PYTHONPATH.


this seems to work well.




On Wednesday, 4 April 2012 12:54:06 UTC+10, Rod Watkins wrote:
>
> I know this has been asked before. I don't mean to be an annoyance. I've 
> done the searches are read numerous posts about how to handle this. But the 
> advice conflicts and I've yet to actually fix the problem. 
>
> What is the best way to handle imports for eclipse to get autocomplete to 
> work properly (as well as rid eclipse of all the incorrect error messages?
>
> I rather like having autocomplete functioning since, as a beginner, it 
> helps me discover functionality that I might otherwise miss (besides saving 
> some typing).
>
> Please accept my thanks in advance for any help on this.
>
> Cordially,
> Rod Watkins
>

-- 

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




[web2py] EuroPython

2013-06-07 Thread Massimo DiPierro
Anybody here going to EuroPython?
I may be able to make it for a day or two and if other people are going we can 
organize an Open Space meeting.

-- 

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




[web2py] custom registration fields (no form.custom)

2013-06-07 Thread lesssugar
auth_user stores many fields. For registration, I would like to use only 
some of them. Is there a simple way to specify fields for registration form 
- except form.custom?

It would be great to just set the form

register_form = auth.register()

and then list the fields of auth_user to be used, like

register_form =[Field(A), Field(B), ...]

-- 

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




[web2py] Re: custom registration fields (no form.custom)

2013-06-07 Thread Anthony
Just set the "readable" and "writable" attributes of the fields you don't 
want to show to False.

Anthony

On Friday, June 7, 2013 7:40:07 PM UTC-4, lesssugar wrote:
>
> auth_user stores many fields. For registration, I would like to use only 
> some of them. Is there a simple way to specify fields for registration form 
> - except form.custom?
>
> It would be great to just set the form
>
> register_form = auth.register()
>
> and then list the fields of auth_user to be used, like
>
> register_form =[Field(A), Field(B), ...]
>
>

-- 

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




[web2py] Re: Off Topic - Open source BPM tool?

2013-06-07 Thread 黄祥
had you already checked?
http://en.wikipedia.org/wiki/Business_process_management
http://en.wikipedia.org/wiki/Comparison_of_business_integration_software

best regards

On Friday, June 7, 2013 8:23:39 PM UTC+7, Ramos wrote:
>
> hello, just like to know if there is some kind of open source IDE/GUI for 
> Business Process Management
> We have a budget of 0 
> Thank you
> António
>

-- 

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




[web2py] Re: custom registration fields (no form.custom)

2013-06-07 Thread lesssugar
What if (as you probably already know) I have two registrations forms. In 
one case I need fields A, B, C, D, in the other case - C, D, E. Do I set 
this in the model also?

On Saturday, June 8, 2013 2:01:28 AM UTC+2, Anthony wrote:
>
> Just set the "readable" and "writable" attributes of the fields you don't 
> want to show to False.
>
> Anthony
>
> On Friday, June 7, 2013 7:40:07 PM UTC-4, lesssugar wrote:
>>
>> auth_user stores many fields. For registration, I would like to use only 
>> some of them. Is there a simple way to specify fields for registration form 
>> - except form.custom?
>>
>> It would be great to just set the form
>>
>> register_form = auth.register()
>>
>> and then list the fields of auth_user to be used, like
>>
>> register_form =[Field(A), Field(B), ...]
>>
>>

-- 

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




[web2py] Re: custom registration fields (no form.custom)

2013-06-07 Thread Anthony
You can set the readable and writable attributes of fields wherever you 
want -- so set them conditionally based on the particular registration form 
being served. You might even write a helper function that takes a list of 
fields and sets their readable and writable attributes to True or False -- 
then just pass the relevant fields to that helper function as needed.

Anthony

On Friday, June 7, 2013 8:21:23 PM UTC-4, lesssugar wrote:
>
> What if (as you probably already know) I have two registration forms. In 
> one case I need fields A, B, C, D, in the other case - C, D, E. Do I set 
> this in the model also?
>
> On Saturday, June 8, 2013 2:01:28 AM UTC+2, Anthony wrote:
>>
>> Just set the "readable" and "writable" attributes of the fields you don't 
>> want to show to False.
>>
>> Anthony
>>
>> On Friday, June 7, 2013 7:40:07 PM UTC-4, lesssugar wrote:
>>>
>>> auth_user stores many fields. For registration, I would like to use only 
>>> some of them. Is there a simple way to specify fields for registration form 
>>> - except form.custom?
>>>
>>> It would be great to just set the form
>>>
>>> register_form = auth.register()
>>>
>>> and then list the fields of auth_user to be used, like
>>>
>>> register_form =[Field(A), Field(B), ...]
>>>
>>>

-- 

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




[web2py] Re: custom registration fields (no form.custom)

2013-06-07 Thread lesssugar
Thanks, I'll dig through it.

On Saturday, June 8, 2013 2:35:59 AM UTC+2, Anthony wrote:
>
> You can set the readable and writable attributes of fields wherever you 
> want -- so set them conditionally based on the particular registration form 
> being served. You might even write a helper function that takes a list of 
> fields and sets their readable and writable attributes to True or False -- 
> then just pass the relevant fields to that helper function as needed.
>
> Anthony
>
> On Friday, June 7, 2013 8:21:23 PM UTC-4, lesssugar wrote:
>>
>> What if (as you probably already know) I have two registration forms. In 
>> one case I need fields A, B, C, D, in the other case - C, D, E. Do I set 
>> this in the model also?
>>
>> On Saturday, June 8, 2013 2:01:28 AM UTC+2, Anthony wrote:
>>>
>>> Just set the "readable" and "writable" attributes of the fields you 
>>> don't want to show to False.
>>>
>>> Anthony
>>>
>>> On Friday, June 7, 2013 7:40:07 PM UTC-4, lesssugar wrote:

 auth_user stores many fields. For registration, I would like to use 
 only some of them. Is there a simple way to specify fields for 
 registration 
 form - except form.custom?

 It would be great to just set the form

 register_form = auth.register()

 and then list the fields of auth_user to be used, like

 register_form =[Field(A), Field(B), ...]



-- 

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




Re: [web2py] web2py in education

2013-06-07 Thread Ovidio Marinho
Hello Massimo,
Use web2py to teach users use the frame and develop their applications.
My name is Ovidio Marinho
I am a web developer
Have academic and professional projects
I will make a new class on 01/07/2013
http://stoodos.com/c/web2py/478?s_v=2&utm_expid=43885913-12
language course Portuguese - Brazil




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
   83   8826 9088 - Oi
   83   9336 3782 - Claro
Brasil



2013/6/7 Massimo Di Pierro 

> Can you please help me
>
> Do you use web2py in a class?
> What is your name?
> What is your position (teacher, student, etc.)?
> What is the instructor name (if not you)?
> How was web2py uses (to do a project, as teaching tool, etc.)?
> Where is the class taught?
> When was is taught (can be a date in the future if you plan to do so)?
> What did you like and what did you not like about the class?
> Will this class be taught again using web2py?
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




Re: [web2py] Re: where is the json data when using GWT's RequestBuilder() ?

2013-06-07 Thread Carl Roach
thanks. both request.vars and response.body.read() are empty.

I'm calling my function: http://127.0.0.1:8000/init/default/call.jsp

I think it must be something in my Java GWT app that's not setting
something for Web2py to identify that there is json data.



On 7 June 2013 20:16, Niphlod  wrote:

> if you're using recent web2py releases, that are able to parse POST vars
> encoded in json, you should have them in request.vars as usual. Otherwise,
> see response.body.read()
>
> On Friday, June 7, 2013 5:24:44 PM UTC+2, Carl wrote:
>>
>> From a GWT app I'm calling my Web2py server app.
>>
>> String jsonData = "{'example' : 'example data'}";
>> builder.setHeader("Accept", "application/json");
>> builder.setHeader("Content-**type", "application/json");
>> builder.setHeader("Content-**length", Integer.toString(jsonData.**
>> length()));
>> builder.sendRequest(jsonData, new RequestCallback() { ... }
>>
>> Where in Web2py can I access jsonData?
>> I've looked thru 'request' but can't locate "example data".
>>
>>
>>
>>  --
>
> ---
> 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/VM2rOQqQBmQ/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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