[web2py] Re: hide profile fields based on role

2015-05-30 Thread DeanK
Oh.  yeah it is because I have that at the bottom of the model.

Could I move this check to after .define_tables()?  Would I have to just 
set auth.settings.table_user again?

 

On Saturday, May 30, 2015 at 7:14:06 PM UTC-4, Anthony wrote:
>
> Is this before you run auth.define_tables()?
>
> On Saturday, May 30, 2015 at 5:51:45 PM UTC-4, DeanK wrote:
>>
>> I'm trying to hide profile fields based on user role.  For example 
>> "basic_user" should have some fields hidden.  So in my db.py where I'm 
>> setting up a custom auth table:
>>
>> if 'profile' in request.args:
>> # If the user is a basic_user hide power_user stuff
>> if auth.has_membership('basic_user'):
>> custom_auth_table.custom_field1.readable = False
>> custom_auth_table.custom_field1.writable = False
>>
>> custom_auth_table.custom_field2.readable = False
>> custom_auth_table.custom_field2.writable = False
>>
>>
>>
>> When I try to view the profile I get this error:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications//models/db.py" 
>> <https://52.1.146.129/admin/default/edit/flipoto/models/db.py>, line 191, in 
>> 
>> if auth.has_membership('basic_user'):
>>   File "/home/www-data/web2py/gluon/tools.py", line 3542, in has_membership
>> group_id = self.id_group(group_id)  # interpret group_id as a role
>>   File "/home/www-data/web2py/gluon/tools.py", line 3512, in id_group
>> rows = self.db(self.table_group().role == role).select()
>>   File "/home/www-data/web2py/gluon/tools.py", line 1406, in table_group
>> return self.db[self.settings.table_group_name]
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 900, 
>> in __getitem__
>> return self.__getattr__(str(key))
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 907, 
>> in __getattr__
>> return ogetattr(self, key)
>> AttributeError: 'DAL' object has no attribute 'auth_group'
>>
>>
>>
>> Is auth not setup yet at this point in the request or something like 
>> that?  Anyone have any thoughts?  Thanks.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] hide profile fields based on role

2015-05-30 Thread DeanK
I'm trying to hide profile fields based on user role.  For example 
"basic_user" should have some fields hidden.  So in my db.py where I'm 
setting up a custom auth table:

if 'profile' in request.args:
# If the user is a basic_user hide power_user stuff
if auth.has_membership('basic_user'):
custom_auth_table.custom_field1.readable = False
custom_auth_table.custom_field1.writable = False

custom_auth_table.custom_field2.readable = False
custom_auth_table.custom_field2.writable = False



When I try to view the profile I get this error:

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

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/www-data/web2py/applications//models/db.py" 
, line 191, in 

if auth.has_membership('basic_user'):
  File "/home/www-data/web2py/gluon/tools.py", line 3542, in has_membership
group_id = self.id_group(group_id)  # interpret group_id as a role
  File "/home/www-data/web2py/gluon/tools.py", line 3512, in id_group
rows = self.db(self.table_group().role == role).select()
  File "/home/www-data/web2py/gluon/tools.py", line 1406, in table_group
return self.db[self.settings.table_group_name]
  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 900, in 
__getitem__
return self.__getattr__(str(key))
  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 907, in 
__getattr__
return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'auth_group'



Is auth not setup yet at this point in the request or something like that? 
 Anyone have any thoughts?  Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: LinkedIn API Please help for the love of god.

2015-03-27 Thread DeanK
@Derek - Did you get auth0 integrated with web2py?  

On Monday, March 2, 2015 at 2:33:59 PM UTC-5, Derek wrote:
>
> It would help if you describe what you are doing, some code behind how you 
> are doing it, and what errors you are having. 
>
> That said, I've had much success with Auth0.
> https://auth0.com 
> 
>
>
>
>
> On Monday, March 2, 2015 at 10:56:36 AM UTC-7, John Costantino wrote:
>>
>> I have been trying to get this to work now for over 3 weeks. I have 
>> pulled data with the javascript API no problem but I wan't users to be able 
>> to log in using there linkedin accounts. I have tried the way suggested in 
>> the book as well as many of the various other implementations on the 
>> internet. Does anyone have a good definitive walk through with how to get 
>> the login with linkedin working. I am pulling my hair out over here 
>> constantly getting errors no matter what I try. Maybe I am doing something 
>> wrong but can someone please give me the run down. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: scheduler worker assignment and disable behavior

2014-06-12 Thread DeanK
it with my long running 3-4 hr tasks).  Looking 
   in the comfy monitor, the task has a complete run and i see the output, but 
   it gets scheduled and run again.  Since my code does cleanup after the 
   first run, the input data is missing so the second run fails (which is how 
   i noticed this).  Not sure why this is happening and may need to try to 
   figure out how to reproduce reliably for debugging.
   - I've seen situations where I know a task is running, but things are 
   still listed as assigned.  I know this because i can see how many tasks are 
   physically running on the worker nodes and can compare that to what the 
   scheduler is reporting.  I would assume tasks i know to be running should 
   equal tasks listed as running.



Thanks again for the help and making all this easy, awesome, and free.  

Dean



On Saturday, June 7, 2014 12:35:56 PM UTC-4, Niphlod wrote:
>
> ok, my responses are inline your post
>
> On Friday, June 6, 2014 9:34:00 PM UTC+2, DeanK wrote:
>>
>> I'm have a few things that need clarification and am also experiencing 
>> some odd behavior with the scheduler. I'm using my app's db instance 
>> (mysql) for the scheduler.
>>
>
> mysql is the uttermost/personal top 1 dislike/non-standard behaving 
> backend out there, but we'll manage ^_^
>  
>
>>
>> at the bottom of scheduler.py:
>>
>>
>> from gluon.scheduler import Scheduler
>>
>> scheduler = Scheduler(db,heartbeat=3)
>>
>>
>>
>> I start my workers like this:
>>
>> head node:
>>
>> python web2py.py -K myapp:upload,myapp:upload,myapp:upload,myapp:upload,
>> myapp:upload,myapp:download,myapp:download,myapp:download,myapp:download,
>> myapp:download,myapp:head_monitorQ 
>>
>>
> 5 upload, 5 download, 1 headmonitorQ. 11 workers
>  
>
>> 5 compute nodes:
>>
>> GROUP0="myapp:"$HOSTNAME"_comp_0:compQ"
>> GROUP1="myapp:"$HOSTNAME"_comp_1:compQ"
>> GROUP2="myapp:"$HOSTNAME"_comp_2:compQ"
>> GROUP3="myapp:"$HOSTNAME"_comp_3:compQ"
>> GROUP4="myapp:"$HOSTNAME"_comp_4:compQ"
>> GROUP5="myapp:"$HOSTNAME"_comp_5:compQ"
>> GROUP6="myapp:"$HOSTNAME"_comp_6:compQ"
>> MON="myapp:"$HOSTNAME"_monitorQ"
>>
>> python web2py.py -K 
>> $GROUP0,$GROUP1,$GROUP2,$GROUP3,$GROUP4,$GROUP5,$GROUP6,$MON
>>
>>
>> The head node has 4 "upload" and 4 "download" processes.  Each compute 
>> node has 7 "compQ" processes that do the actual work.  The hostname based 
>> groups are unique so I can remotely manage the workers.  The monitorQ's run 
>> a task every 30s to provide hw monitoring to my application.
>>
>
> and if by "node" you mean a completely different server, you have 7*5 = 35 
> additional workers on top of the 11 on the "head". That's quite a number of 
> workers, I hope they are there because you need to process at least 46 
> tasks in parallel, otherwise, it's just a waste of processes and groups. 
> Don't know about the sentence "hostname based groups are unique so I can 
> remotely manage the workers" because by default scheduler workers names 
> are  "hostname#pid" tagged, so unique by default. On top of that, the 
> default heartbeat of 3 seconds means that even when there are no tasks to 
> process, you have a potential of 46 concurrent processes hitting the 
> database every 3 seconds...is that necessary ?
>  
>
>>
>> 1) I have the need to dynamically enable/disable workers to match 
>> available hardware.  I was hoping to do this with the disable/resume 
>> commands but the behavior isn't what I had hoped (but I think what is 
>> intended).  I would like to send a command that will stop a worker from 
>> getting assigned/picking up jobs until a resume is issued.  From the docs 
>> and experimenting, it looks like all disable does is simply sleep the 
>> worker for a little bit and then it gets right back to work.  To get my 
>> current desired behavior I issue a terminate command, but then i need to 
>> ssh into each compute node and restart workers when i want to scale back 
>> up...which works but is less than ideal.
>>
>> *Is there any way to "toggle" a worker into a disabled state?*
>>
>> funny you say that, I'm actually working on an "autoscaling" management 
> that spawns additional workers (and kills them) when a certain criteria is 
> met to deal with spikes of queued tasks. Let's forget 

[web2py] scheduler worker assignment and disable behavior

2014-06-06 Thread DeanK
I'm have a few things that need clarification and am also experiencing some 
odd behavior with the scheduler. I'm using my app's db instance (mysql) for 
the scheduler.

at the bottom of scheduler.py:


from gluon.scheduler import Scheduler

scheduler = Scheduler(db,heartbeat=3)



I start my workers like this:

head node:

python web2py.py -K myapp:upload,myapp:upload,myapp:upload,myapp:upload,
myapp:upload,myapp:download,myapp:download,myapp:download,myapp:download,
myapp:download,myapp:head_monitorQ 

5 compute nodes:

GROUP0="myapp:"$HOSTNAME"_comp_0:compQ"
GROUP1="myapp:"$HOSTNAME"_comp_1:compQ"
GROUP2="myapp:"$HOSTNAME"_comp_2:compQ"
GROUP3="myapp:"$HOSTNAME"_comp_3:compQ"
GROUP4="myapp:"$HOSTNAME"_comp_4:compQ"
GROUP5="myapp:"$HOSTNAME"_comp_5:compQ"
GROUP6="myapp:"$HOSTNAME"_comp_6:compQ"
MON="myapp:"$HOSTNAME"_monitorQ"

python web2py.py -K 
$GROUP0,$GROUP1,$GROUP2,$GROUP3,$GROUP4,$GROUP5,$GROUP6,$MON


The head node has 4 "upload" and 4 "download" processes.  Each compute node 
has 7 "compQ" processes that do the actual work.  The hostname based groups 
are unique so I can remotely manage the workers.  The monitorQ's run a task 
every 30s to provide hw monitoring to my application.


1) I have the need to dynamically enable/disable workers to match available 
hardware.  I was hoping to do this with the disable/resume commands but the 
behavior isn't what I had hoped (but I think what is intended).  I would 
like to send a command that will stop a worker from getting 
assigned/picking up jobs until a resume is issued.  From the docs and 
experimenting, it looks like all disable does is simply sleep the worker 
for a little bit and then it gets right back to work.  To get my current 
desired behavior I issue a terminate command, but then i need to ssh into 
each compute node and restart workers when i want to scale back up...which 
works but is less than ideal.

*Is there any way to "toggle" a worker into a disabled state?*




2) A previous post from Niphlod explains the worker assignment:

A QUEUED task is not picked up by a worker, it is first ASSIGNED to a 
> worker that can pick up only the ones ASSIGNED to him. The "assignment" 
> phase is important because:
> - the group_name parameter is honored (task queued with the group_name 
> 'foo' gets assigned only to workers that process 'foo' tasks (the 
> group_names column in scheduler_workers))
> - DISABLED, KILL and TERMINATE workers are "removed" from the assignment 
> alltogether 
> - in multiple workers situations the QUEUED tasks are split amongst 
> workers evenly, and workers "know in advance" what tasks they are allowed 
> to execute (the assignment allows the scheduler to set up n "independant" 
> queues for the n ACTIVE workers)


This is an issue for me, because my tasks do not have a uniform run time. 
 Some jobs can take 4 minutes while some can take 4 hours.  I keep getting 
into situations where a node is sitting there with plenty of idle workers 
available, but they apparently don't have tasks to pick up.  Another node 
is chugging along with a bunch of backlogged assigned tasks.  Also 
sometimes a single worker on a node is left with all the assigned tasks 
while the other works are sitting idle.

*Is there any built-in way to periodically force a reassignment of tasks to 
deal with this type if situation?*




3) I had been using "immediate=True" on all of my tasks.  I started to see 
db deadlock errors occasionally when scheduling jobs using queue_task(). 
 Removing "immediate=True" seemed to fix this problem.

*Is there any reason why immediate could be causing deadlocks?*






-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: assign task to specific group

2014-05-21 Thread DeanK
Yes I did read the docs several times.  And I'm not doubting you since you 
have been right every time I've asked a question haha...but I still don't 
see it.  From the documentation the prototype when scheduling a task is:

scheduler.queue_task(
function,
pargs=[],
pvars={},
start_time=now, #datetime
stop_time = None,   #datetime
timeout = 60,   #seconds
prevent_drift=False,
period=60,  #seconds
immediate=False,
repeats = 1
)


I don't see anywhere a mention on how you set the group_names parameter.



On Wednesday, May 21, 2014 3:30:42 AM UTC-4, Niphlod wrote:
>
> You can pass group names with the -K argument, when you start the process. 
> When you queue a task, you must pass in the group_name parameter to 
> "reserve" that task for a specific worker.
>
>
> BTW: did you at least tried to read 
> http://web2py.com/books/default/chapter/29/04/the-core#web2py-Schedulerbefore 
> asking ?
>
>
> On Tuesday, May 20, 2014 9:46:39 PM UTC+2, DeanK wrote:
>>
>> I'm looking to use the built in scheduler to farm out work, but run gpu 
>> dependent code.  Because of this I need to be able to control on which node 
>> the task is scheduled.  I thought I could do this using "groups" but I 
>> don't see how since you set the group in the scheduler constructor 
>> according to the docs?  I was expecting you would set groups that workers 
>> are "subscribed" to when you start them on each node and then when you 
>> schedule a task you can set which group the task is assigned to.  Is this 
>> not possible or have I misinterpreted the documentation?
>>
>> scheduler.py in models:
>>
>> def my_task1():
>>#my first task
>>
>> def my_task2():
>>#another task
>>
>> from gluon.scheduler import Scheduler
>>
>> db_sched = 
>> DAL('mysql://:X@X/',pool_size=8,check_reserved=['mysql'],migrate=True,fake_migrate_all=False,lazy_tables=False)
>> scheduler = Scheduler(db_sched,heartbeat=2)
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] assign task to specific group

2014-05-20 Thread DeanK
I'm looking to use the built in scheduler to farm out work, but run gpu 
dependent code.  Because of this I need to be able to control on which node 
the task is scheduled.  I thought I could do this using "groups" but I 
don't see how since you set the group in the scheduler constructor 
according to the docs?  I was expecting you would set groups that workers 
are "subscribed" to when you start them on each node and then when you 
schedule a task you can set which group the task is assigned to.  Is this 
not possible or have I misinterpreted the documentation?

scheduler.py in models:

def my_task1():
   #my first task

def my_task2():
   #another task

from gluon.scheduler import Scheduler

db_sched = 
DAL('mysql://:X@X/',pool_size=8,check_reserved=['mysql'],migrate=True,fake_migrate_all=False,lazy_tables=False)
scheduler = Scheduler(db_sched,heartbeat=2)



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: only one session/login per user?

2014-02-13 Thread DeanK
So I started looking into trying to get this to work and I'm stuck, mainly 
because web2py storing sessions in Redis is a blackbox to me.  I couldn't 
find anywhere in the documentation how to query the session db.  I'm 
storing my sessions in redis following the code snippet in the deployment 
recipes. 

I'm able to find all the IPs the user has logged in within the last 24 
hours:

from datetime import date, timedelta

d_window = date.today()-timedelta(days=1)

events = eval('db((db.auth_event.user_id == auth.user_id) & 
(db.auth_event.time_stamp > d_window) & (db.auth_event.description == "User 
%d Logged-in")).select()' % (auth.user_id))

iplist = {};
for event in events:
iplist[event.client_ip] = 1


But now i'm not sure how to query redis to find the sessions for those IPs, 
link them to the user, check for auth objects, and delete the ones i need 
to. Any pointers in the right direction would be appreciated.  As always 
thanks for the help.

Dean


On Monday, February 10, 2014 4:55:15 PM UTC-5, Anthony wrote:
>
> Speaking as a naive developer, the "cpu/io intensive" remark suggests to 
>> me that the onlogin hook be used to queue a job for a worker thread that 
>> would carry out the hunt-and-flush mission.  Or would that be the wrong 
>> hammer for this torque screw?
>>
>
> Sounds reasonable, though I would test to see how long it takes to 
> determine if that's really necessary.
>
> Anthony 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: only one session/login per user?

2014-02-08 Thread DeanK
Thanks Anthony. I think I like the sound of your last suggestion. I'm going 
to try that one out.


On Tuesday, February 4, 2014 10:16:46 AM UTC-5, Anthony wrote:
>
> Note, this can be tricky. It is difficult to explicitly log out a user in 
> one session based on a login within a different session. This is because 
> technically sessions do not expire, so it's not easy to know if another 
> login is still active, and it's also difficult to find a given session 
> file/db record (outside of requests made by that session).
>
> One simple approach might be the following. Add a "current_ip" field to 
> the auth_user table. When a user logs in, put the value of request.client 
> in that field. Not tested, but something like:
>
> auth.settings.login_onaccept.append(lambda form:
> db.auth_user(auth.user_id).update_record(current_ip=request.client))
>
> Then, on every subsequent request, check to make sure request.client 
> equals the value in the current_ip field. Something like:
>
> @auth.requires(lambda: db.auth_user(auth.user_id).current_ip == request.
> client)
>
> So, a user logs in from machine A, and the machine A ip address is stored 
> in current_ip. Then a user logs in from machine B with the same account, so 
> the machine B ip address is stored in current_ip. At that point, if machine 
> A makes another request, its request.client will no longer match 
> current_ip, so access will be denied (until the user on machine A logs out 
> and logs back in, which will then prevent machine B from further access).
>
> The downside of this approach is that it requires a database query on 
> every request to check the ip address.
>
> An alternative would be upon login, check the auth_event table for logins 
> of the same user within some recent time period (e.g., the last 24 hours). 
> Then grab the ip addresses of those logins (which are stored in 
> db.auth_event.client_ip). Then find all of the sessions whose file names 
> (or session ID's if stored in the database) start with any of those ip 
> addresses (excluding the ip address of the current request, of course). 
> Then check each of those sessions to see if they include an "auth" object 
> for the current user, and if so, delete that "auth" object from the session 
> (or simply delete the session entirely). This is a bit more complicated and 
> CPU/IO intensive, but it only happens upon login, not on every request. 
> Also, it won't work with cookie based sessions.
>
> Anthony
>
> On Tuesday, February 4, 2014 1:41:52 AM UTC-5, DeanK wrote:
>>
>> I've been searching around trying to figure out how to do this without 
>> success.  I need to enforce only a single login per user.  Out of the box 
>> you can login using the same credentials from different computers, but I 
>> need logging in on a different computer to terminate the session of the 
>> first log in.  Is this possible?  I found some posts that hinted at using 
>> session.connect, but then i couldn't find "check_client" in the ebook...and 
>> it didn't seem to work when i tested it.
>>
>>
>> ## Limit single user sessions
>> session.connect(request,response,check_client=True) 
>>
>> Any tips would be appreciated.  Thanks,
>>
>> Dean
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] only one session/login per user?

2014-02-03 Thread DeanK
I've been searching around trying to figure out how to do this without 
success.  I need to enforce only a single login per user.  Out of the box 
you can login using the same credentials from different computers, but I 
need logging in on a different computer to terminate the session of the 
first log in.  Is this possible?  I found some posts that hinted at using 
session.connect, but then i couldn't find "check_client" in the ebook...and 
it didn't seem to work when i tested it.


## Limit single user sessions
session.connect(request,response,check_client=True) 

Any tips would be appreciated.  Thanks,

Dean

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: footer content aligned left when reverse proxied

2013-12-19 Thread DeanK
I noticed that in web2py.css:

.center {width:100; text-align:center; vertical-align:middle}


if i change this to:

.center {width:100%; text-align:center; vertical-align:middle}


things then work fine.


On Thursday, December 19, 2013 11:54:37 AM UTC-5, DeanK wrote:
>
> When I view my site directly through the host server the footer looks 
> fine.  It's snapped to the bottom and centered.
>
> When I view my site through a reverse proxy, the footer content is smashed 
> to the left, as if its in a column or something.  Looking at the html I 
> can't really see anything different.  Is there something going on in the 
> built in web2py css or js that is formatting the footer and would be 
> sensitive to a reverse proxy that i need to consider??  Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] footer content aligned left when reverse proxied

2013-12-19 Thread DeanK
When I view my site directly through the host server the footer looks 
fine.  It's snapped to the bottom and centered.

When I view my site through a reverse proxy, the footer content is smashed 
to the left, as if its in a column or something.  Looking at the html I 
can't really see anything different.  Is there something going on in the 
built in web2py css or js that is formatting the footer and would be 
sensitive to a reverse proxy that i need to consider??  Thanks,

Dean

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Reset password based on username instead of email

2013-11-18 Thread DeanK
Will do.  I could create a fix on my own by creating a new Auth class that 
inherits from auth and just override the  'reset_password' method, correct? 
 That way I should still be able to update as long as nothing new happens 
in gluon.Auth.reset_password?



On Saturday, November 16, 2013 3:58:56 AM UTC-5, Massimo Di Pierro wrote:
>
> Please open a ticket. This needs to be implemented.
>
> On Friday, 15 November 2013 11:07:31 UTC-6, DeanK wrote:
>>
>> So I have a somewhat unique situation where multiple different users will 
>> be creating separate accounts with unique usernames, using the SAME email 
>> address.  I figured I could make this happen by using custom auth tables 
>> like this:
>>
>> ## Manually set up Auth tables so you can have non-unique emails
>> db.define_table(
>> auth.settings.table_user_name,
>> Field('username', length=32, default=''),
>> Field('first_name', length=128, default=''),
>> Field('last_initial', length=1, default=''),
>> Field('email', length=128, default=''), # required
>> Field('password', 'password', length=512,# required
>>   readable=False, label='Password'),
>> Field('registration_key', length=512,# required
>>   writable=False, readable=False, default=''),
>> Field('reset_password_key', length=512,  # required
>>   writable=False, readable=False, default=''),
>> Field('registration_id', length=512, # required
>>   writable=False, readable=False, default=''))
>>
>> ## do not forget validators
>> custom_auth_table = db[auth.settings.table_user_name] # get the 
>> custom_auth_table
>> custom_auth_table.first_name.requires =   
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> custom_auth_table.last_initial.requires =   
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> custom_auth_table.password.requires = [CRYPT()]
>> custom_auth_table.email.requires = 
>> [IS_EMAIL(error_message=auth.messages.invalid_email)]
>> custom_auth_table.username.requires = IS_NOT_IN_DB(db, 
>> custom_auth_table.username)
>>
>> auth.settings.table_user = custom_auth_table # tell auth to use 
>> custom_auth_table
>>
>> # Define auth tables
>> auth.define_tables(username=True, signature=False)
>>
>>
>> There are two issues with this approach.
>>
>> First, "forgot password" asks for an email still and resets the first 
>> account in the table with that user name.  Is there a way to reset based on 
>> username built in to web2py?  I couldn't seem to find anything in the 
>> documentation so i'm thinking no unfortunately...
>>
>> Second, and less vital, is the "forgot username" functionality emails the 
>> first username in the table linked to the entered email only.  Ideally you 
>> would email the names and usernames of all accounts linked to the email 
>> address.
>>
>>
>> Is there any way I could enable the described desired functionality? 
>>  Could I somehow extend the existing login functionality without breaking 
>> the ability to update my web2py instance (basically changes that don't 
>> touch core web2py code)?  
>>
>> Thanks,
>> Dean
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Reset password based on username instead of email

2013-11-15 Thread DeanK
So I have a somewhat unique situation where multiple different users will 
be creating separate accounts with unique usernames, using the SAME email 
address.  I figured I could make this happen by using custom auth tables 
like this:

## Manually set up Auth tables so you can have non-unique emails
db.define_table(
auth.settings.table_user_name,
Field('username', length=32, default=''),
Field('first_name', length=128, default=''),
Field('last_initial', length=1, default=''),
Field('email', length=128, default=''), # required
Field('password', 'password', length=512,# required
  readable=False, label='Password'),
Field('registration_key', length=512,# required
  writable=False, readable=False, default=''),
Field('reset_password_key', length=512,  # required
  writable=False, readable=False, default=''),
Field('registration_id', length=512, # required
  writable=False, readable=False, default=''))

## do not forget validators
custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table
custom_auth_table.first_name.requires =   
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.last_initial.requires =   
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = [CRYPT()]
custom_auth_table.email.requires = 
[IS_EMAIL(error_message=auth.messages.invalid_email)]
custom_auth_table.username.requires = IS_NOT_IN_DB(db, 
custom_auth_table.username)

auth.settings.table_user = custom_auth_table # tell auth to use 
custom_auth_table

# Define auth tables
auth.define_tables(username=True, signature=False)


There are two issues with this approach.

First, "forgot password" asks for an email still and resets the first 
account in the table with that user name.  Is there a way to reset based on 
username built in to web2py?  I couldn't seem to find anything in the 
documentation so i'm thinking no unfortunately...

Second, and less vital, is the "forgot username" functionality emails the 
first username in the table linked to the entered email only.  Ideally you 
would email the names and usernames of all accounts linked to the email 
address.


Is there any way I could enable the described desired functionality?  Could 
I somehow extend the existing login functionality without breaking the 
ability to update my web2py instance (basically changes that don't touch 
core web2py code)?  

Thanks,
Dean



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py ajax failing when behind reverse proxy

2013-11-15 Thread DeanK
Awesome.  I was trying to use mod_substitute to replace the url in the data 
tag but things weren't loading right.  Anthony's suggestions worked.  I'm 
going to do some more extensive testing, but at first glance it looks like 
that did the trick.  Thanks!



On Friday, November 15, 2013 10:44:34 AM UTC-5, Anthony wrote:
>
> Does it work if you add the following to your proxy_html.conf file:
>
> ProxyHTMLLinksdiv data-w2p_remote
>
>
> See 
> http://httpd.apache.org/docs/current/mod/mod_proxy_html.html#proxyhtmllinks
>  and 
> http://apache.webthing.com/svn/apache/filters/proxy_html/proxy_html.conf.
>
> Anthony
>
> On Thursday, November 14, 2013 6:46:42 PM UTC-5, DeanK wrote:
>>
>> I'm having trouble with a web2py site sitting behind an Apache2 reverse 
>> proxy that uses web2py's built in ajax capability.  The main domain server 
>> configuration is setup like this to point to the server running my web2py 
>> app:
>>
>> ProxyHTMLInterp On
>> LogLevel Debug
>> ProxyHTMLLogVerbose On
>> ProxyPass /link/ http://my.server.com/
>> ProxyPassReverse /link/ http://my.server.com/
>>
>> ProxyHTMLURLMap http://my.server.com /link/
>>
>> 
>>ProxyPassReverse /
>>SetOutputFilter  proxy-html
>>ProxyHTMLURLMap http://my.server.com /link/
>>ProxyHTMLURLMap / /link/
>>ProxyHTMLURLMap  /link/ /link/
>>RequestHeaderunset  Accept-Encoding
>> 
>>
>> So now if I go to http://maindomain.com/link/ it loads my web2py app 
>> from http://my.server.com
>>
>> With this configuration things more or less appear to work for http right 
>> now (i still need to sort out https).  The only issue is all of my ajax 
>> calls that use web2py's built in LOAD() function break.  I'm thinking this 
>> is because proxy_html doesn't recognize the ajax call in the html to 
>> rewrite it due to how web2py does things?
>>
>> view snippet:
>> 
>>
>> {{=LOAD('project','project_grid.load', 
>> ajax=True,ajax_trap=True,user_signature=True,target="project1")}} 
>>
>> 
>>
>>
>> html after proxy:
>> ...
>>
>> >  
>> id="project1">loading... 
>>
>> ...
>>
>>
>> here if the url rewrite worked this should have pointed to 
>> /link/myapp/project/project_grid.load
>>
>>
>>
>> Anyone have any experience with this?  Is there somehow i can tell web2py 
>> to add the prefix for only the LOAD() methods or something? Thanks.
>>
>>
>>
>>
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: configuring routes for web2py behind reverse proxy

2013-11-14 Thread DeanK
For anyone in the future trying to do this with Apache2 on Ubuntu:

ProxyHTMLInterp On
LogLevel Debug
ProxyHTMLLogVerbose On
ProxyPass /link/ http://my.server.com/
ProxyPassReverse /link/ http://my.server.com/

ProxyHTMLURLMap http://my.server.com /link/


  ProxyPassReverse /
  SetOutputFilter  proxy-html
  ProxyHTMLURLMap http://my.server.com /link/
  ProxyHTMLURLMap / /link/
  ProxyHTMLURLMap  /link/ /link/
  RequestHeaderunset  Accept-Encoding




On Tuesday, November 5, 2013 11:51:11 AM UTC-5, DeanK wrote:
>
> I have an instance of web2py running on nginx sitting behind an apache 
> reverse proxy (soon to be nginx as well) so:
>
> www.mydomain.com/myapppoints to >>myserver1.otherdomain.com
>
> i have /myapp/default/landing set as the default application, controller, 
> and function.  When i go directly to myserver1.otherdomain.com everything 
> is fine, but if i go to www.mydomain.com/myapp all of my static files are 
> unreachable because the relative paths point to 
> www.mydomain.com/myapp/static/file where really it would have to be 
> www.mydomain.com/myapp/myapp/static/file which is kind of ugly.  I am 
> using URL() to create relative links.
>
> I first though maybe the fact the the reverse proxy url and app names are 
> the same was confusing regex or whatever was doing the rewrites, but that 
> didn't seem to be the case.  I also started looking at routes.py and set 
> BASE = 'myapp'.  That made parts of my site work, but things like login 
> then didn't.
>
>
> Anyone have experience setting a web2py app up behind a reverse proxy? 
>  Thoughts? Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] web2py ajax failing when behind reverse proxy

2013-11-14 Thread DeanK
I'm having trouble with a web2py site sitting behind an Apache2 reverse 
proxy that uses web2py's built in ajax capability.  The main domain server 
configuration is setup like this to point to the server running my web2py 
app:

ProxyHTMLInterp On
LogLevel Debug
ProxyHTMLLogVerbose On
ProxyPass /link/ http://my.server.com/
ProxyPassReverse /link/ http://my.server.com/

ProxyHTMLURLMap http://my.server.com /link/


   ProxyPassReverse /
   SetOutputFilter  proxy-html
   ProxyHTMLURLMap http://my.server.com /link/
   ProxyHTMLURLMap / /link/
   ProxyHTMLURLMap  /link/ /link/
   RequestHeaderunset  Accept-Encoding


So now if I go to http://maindomain.com/link/ it loads my web2py app from 
http://my.server.com

With this configuration things more or less appear to work for http right 
now (i still need to sort out https).  The only issue is all of my ajax 
calls that use web2py's built in LOAD() function break.  I'm thinking this 
is because proxy_html doesn't recognize the ajax call in the html to 
rewrite it due to how web2py does things?

view snippet:


{{=LOAD('project','project_grid.load', 
ajax=True,ajax_trap=True,user_signature=True,target="project1")}} 




html after proxy:
...

loading... 

...


here if the url rewrite worked this should have pointed to 
/link/myapp/project/project_grid.load



Anyone have any experience with this?  Is there somehow i can tell web2py 
to add the prefix for only the LOAD() methods or something? Thanks.







-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: configuring routes for web2py behind reverse proxy

2013-11-07 Thread DeanK
So I changed my reverse proxy set up to make debug a bit easier and maybe 
will get some suggestions from someone now:

I have an instance of web2py running on nginx sitting behind an apache 
reverse proxy so:

www.mydomain.com/linkpoints tomyserver1.otherdomain.com

i have /myapp/default/index set as the default application, controller, and 
function.  When i go directly to myserver1.otherdomain.com everything works 
as expected. If i go to www.mydomain.com/link all of my static files are 
unreachable because the relative paths point to 
www.mydomain.com/myapp/static/file where really it would have to be 
www.mydomain.com/link/myapp/static/file.  I am using URL() to create 
relative links.

Looking at routes.py it seems like I should be setting BASE = 'link'

When I do this going to www.mydomain.com/link works 
(www.mydomain.com/link/doesn't), but the site as a whole doesn't.  For example, 
if I try to log 
in, that page loses its static files.  Looking at what the static files now 
point to I get this which is clearly wrong:

http://www.mydomain.com/link/myapp/default/user/link/myapp/static/images/favicon.ico

Another example going to a simple page /myapp/default/learn

http://www.mydomain.com/link/myapp/default/link/myapp/static/js/modernizr.custom.js


It looks like urls are getting re-written twice or something?  Does anyone 
have any suggestions on how to configure a web2py application to work 
behind a reverse proxy?

Dean




On Tuesday, November 5, 2013 11:51:11 AM UTC-5, DeanK wrote:
>
> I have an instance of web2py running on nginx sitting behind an apache 
> reverse proxy (soon to be nginx as well) so:
>
> www.mydomain.com/myapppoints to >>myserver1.otherdomain.com
>
> i have /myapp/default/landing set as the default application, controller, 
> and function.  When i go directly to myserver1.otherdomain.com everything 
> is fine, but if i go to www.mydomain.com/myapp all of my static files are 
> unreachable because the relative paths point to 
> www.mydomain.com/myapp/static/file where really it would have to be 
> www.mydomain.com/myapp/myapp/static/file which is kind of ugly.  I am 
> using URL() to create relative links.
>
> I first though maybe the fact the the reverse proxy url and app names are 
> the same was confusing regex or whatever was doing the rewrites, but that 
> didn't seem to be the case.  I also started looking at routes.py and set 
> BASE = 'myapp'.  That made parts of my site work, but things like login 
> then didn't.
>
>
> Anyone have experience setting a web2py app up behind a reverse proxy? 
>  Thoughts? Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] configuring routes for web2py behind reverse proxy

2013-11-05 Thread DeanK
I have an instance of web2py running on nginx sitting behind an apache 
reverse proxy (soon to be nginx as well) so:

www.mydomain.com/myapppoints to >>myserver1.otherdomain.com

i have /myapp/default/landing set as the default application, controller, 
and function.  When i go directly to myserver1.otherdomain.com everything 
is fine, but if i go to www.mydomain.com/myapp all of my static files are 
unreachable because the relative paths point to 
www.mydomain.com/myapp/static/file where really it would have to be 
www.mydomain.com/myapp/myapp/static/file which is kind of ugly.  I am using 
URL() to create relative links.

I first though maybe the fact the the reverse proxy url and app names are 
the same was confusing regex or whatever was doing the rewrites, but that 
didn't seem to be the case.  I also started looking at routes.py and set 
BASE = 'myapp'.  That made parts of my site work, but things like login 
then didn't.


Anyone have experience setting a web2py app up behind a reverse proxy? 
 Thoughts? Thanks,

Dean

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-28 Thread DeanK
That works well too.  It looks a little better so I'm using it.  Thanks!

On Monday, October 21, 2013 11:24:29 AM UTC-4, Niphlod wrote:
>
> uhm. what if you do
>
> {{=PRE(r_.run_output)}}
>
> Without an example it's hard to guess what should be the correct "style".
>
> On Monday, October 21, 2013 4:26:54 PM UTC+2, DeanK wrote:
>>
>> Awesome thanks.  Everything is working now.
>>
>> I've used the scheduler monitor a decent amount and it has worked pretty 
>> well for me. This is the first bug I've noticed but if I find more I'll be 
>> sure to let you know.  The only tweak I've made is the output from my tasks 
>> contains lots of debug information when things go wrong and it was hard to 
>> interpret since newline characters were not being displayed in the table. 
>>  I simply edited line 29 in run_details.html:
>>
>> {{=XML(r_.run_output.replace('\n', ''))}}
>>
>> It's not the prettiest thing in the world. If there are lots of newline 
>> characters it makes the output look almost doubled spaced, but it is useful 
>> and does the trick.
>>
>>
>> Thanks!
>>
>> On Saturday, October 19, 2013 8:57:14 AM UTC-4, Niphlod wrote:
>>>
>>> BTW, found the issue with comfort scheduler. Will update as soon as 
>>> github comes back.
>>>
>>> [edit] Done
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-21 Thread DeanK
Awesome thanks.  Everything is working now.

I've used the scheduler monitor a decent amount and it has worked pretty 
well for me. This is the first bug I've noticed but if I find more I'll be 
sure to let you know.  The only tweak I've made is the output from my tasks 
contains lots of debug information when things go wrong and it was hard to 
interpret since newline characters were not being displayed in the table. 
 I simply edited line 29 in run_details.html:

{{=XML(r_.run_output.replace('\n', ''))}}

It's not the prettiest thing in the world. If there are lots of newline 
characters it makes the output look almost doubled spaced, but it is useful 
and does the trick.


Thanks!

On Saturday, October 19, 2013 8:57:14 AM UTC-4, Niphlod wrote:
>
> BTW, found the issue with comfort scheduler. Will update as soon as github 
> comes back.
>
> [edit] Done
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-18 Thread DeanK
So I'm working to scale up my web2py based app a bit.  Part of this was 
moving the Scheduler to a separate machine.  Since doing this I'm getting 
some errors and weird behavior and could use some insight.  There are 
multiple issues but I sort of need to explain it all so I opted for 1 post 
with multiple questions instead of multiple concise posts...sorry

My configuration:

"production server" - nginx serving my website. db connects to a mysql 
instance bound to production server network address. scheduler connects to 
mysql instance running on the "dev/workq server"
"dev/workq server" - nginx serving a copy of the same web2py 
directory...plan to use as development server if needed as well.  db 
connects to mysql instance running on production server. scheduler connects 
to mysql instance bound to dev server network address.

from 0_db.py:
db = 
DAL('mysql://dev:xxx...@production.server.edu/myapp',pool_size=8,check_reserved=['mysql'],migrate=ENABLE_MIGRATE,fake_migrate_all=ENABLE_FAKE_MIGRATE)



from scheduler.py:
scheduler = Scheduler(DAL('mysql://workq:x...@dev.workq.server.edu/myapp
',pool_size=8,check_reserved=['mysql'],migrate=ENABLE_MIGRATE,fake_migrate_all=ENABLE_FAKE_MIGRATE),heartbeat=2)




My steps from empty mysql databases and database directories on both 
servers and both mysql instances.
- go to site on the production server - migrate = True, fake_migrate = 
False -> OK
- go to site on the dev server - migrate = True, fake_migrate = False -> 
Error -  (1050, u"Table 
'auth_user' already exists")
- go to site on the dev server - migrate = False, fake_migrate = True -> OK
- start scheduler task -> OK

*Am I starting this all up improperly?  I'm a little confused since I've 
got two web2py instances talking to different db instances for the web app 
and the scheduler...but I think having to do a fake migrate on the second 
server makes sense.*
*
*
*
*
So now I *think* my website is up and running properly.  I then run a 
function that schedules a job.  This seems to run (by looking at the 
comfortscheduler monitor), but it's supposed to schedule additional jobs 
itself.  This never happens.


inside the single task that is scheduled and runs:

for items in my_thing:

  #...do stuff

  # Submit tasks to process more stuff
  print "submitting job \n"
  scheduler.queue_task(my_task2,timeout=6,
pvars=dict(arg1= arg1,
arg2=arg2))
  
  db(db.collections.name == collection).update(last_id=last_id)
  db.commit()



*If I try to view the details of the task in the ComfortScheduler monitor 
(from my production server) by clicking on the UUID link of the task i get 
an error:*

 'DAL' object has no attribute 
'scheduler_task'

1.
2.
3.
4.
5.
6.
7.
8.

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File 
"/home/www-data/web2py/applications/parity/views/plugin_cs_monitor/task_details.html",
 line 111, in 
  File "/home/www-data/web2py/gluon/dal.py", line 8041, in __getattr__
return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'scheduler_task'




I think the problem here is the comfortscheduler code looks at the global 
db object maybe?  Since I've passed in to Scheduler() a different database 
is this breaking things?  This might be a question only niphlod can answer 
since it's his app


So ignoring that for now, if i go and look in the table I can see the 
run_output "submitting job submitting job submitting job submitting job" 
indicating 
it got to the point in the code where it should have submitted more tasks.  
*Any idea why new tasks would not be getting scheduled?  *I think it might 
be because I'm calling db.commit() in my task...but this is on my main 
web2py db, not the db the scheduler is using?  Can i have 2 global db 
objects?  So should the scheduler be setup more like this:

sched_db = DAL('mysql://workq:x...@dev.workq.server.edu/myapp
',pool_size=8,check_reserved=['mysql'],migrate=ENABLE_MIGRATE,fake_migrate_all=ENABLE_FAKE_MIGRATE)
scheduler = Scheduler(sched_db,heartbeat=2)


and then i'd have to call both 

db.commit()
sched_db.commit()

Anyone have a server config like this before?

Long message...lots of questions...sorry and thanks.

Dean




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: model not updated in scheduled task

2013-05-08 Thread DeanK
I just sort of figured it out.  And yes i'm sorry i didn't give enough to 
go on.  

The key seemed to be in the method get_user_allowed_projects. It is in a 
module that is imported into the a model file.  It uses 
current.auth.user_groups and some database tables to check project table 
permissions for the user and stores it in the session. I realized that the 
session is bogus and therefore forced this to update but it still didn't 
work.  Then i realized that current.auth.user_groups was empty when run on 
the scheduler, which resulted in permission to 0 tables which resulted in 0 
tables getting defined which resulted in my error...  

Do tasks run in the scheduler have no concept of the user who scheduled 
them?

My current work around is if the model is getting executed in the scheduler 
(i check this by looking at the length of request.env...is there a better 
way?) then I just define all the tables.  Since it's running on 
the scheduler a little overhead isn't going to kill things, but it's not 
ideal.



On Wednesday, May 8, 2013 2:37:55 PM UTC-4, Niphlod wrote:
>
> the task definitely runs in a fresh environment, but as it stands your 
> explanation doesn't give me enough details to build a proof of concept.
> if you have some  - even weird - code that basically looks up the 
> "projects" table to build definitions of tables, then if that piece of code 
> is executed in the task you should be perfectly fine.
> The only thing I can reproduce is that a task defined as 
>
> def mytest_models():
>  db.define_table('whatever',
>  Field('afield')
>  )
>  db.whatever.insert(afield='foo')
>  db.commit()
>
> works as intended.
>
> On Wednesday, May 8, 2013 6:02:07 PM UTC+2, DeanK wrote:
>>
>> So one of my model files is somewhat unique (and possibly a bad idea) and 
>> causing me problems...I'll try to describe things the best I can.
>>
>> My application creates tables dynamically based on user input.  To stop 
>> web2py from defining all the tables on every request (which can be a lot in 
>> the whole app, but only 10ish per user), I check which tables the user has 
>> access to and define only those.  This is done by looking at a table 
>> (projects) where each record specifies other tables that exist (the project 
>> support tables).
>>
>> The issue i'm having is the user fills out a form using smartgrid.  In 
>> the oncreate callback I update the projects table which essentially 
>> specifies new tables.  These new tables are not defined unless the model 
>> runs again.  I know this will happen on a refresh, but is there any other 
>> way to force the models to update?
>>
>>
>> If I then submit a job to the scheduler that references one of these 
>> "new" tables I get this error:
>>
>> 'DAL' object has no attribute 'test_project_proj'
>>
>> Where test_project_proj one of the support tables that should have been 
>> defined (in the model snippet below project.project_table = 
>> 'test_project_proj') .
>>
>>
>>
>> Example of key part of the model:
>>
>>
>> user_allowed_ids = get_user_allowed_projects(False) for project in db(db.
>> projects.id.belongs(user_allowed_ids)).select():
>> db.define_table(project.project_table,..)
>> db.define_table(project.block_table,..)
>> db.define_table(project.metadata_table,..)
>>
>>
>> 
>>
>> I thought that when a job runs on the scheduler it re-runs all the models, 
>> so i don't understand why the task isn't seeing the new tables.  Thoughts?  
>> Thanks
>>
>>
>>
>> Dean
>>
>>
>>
>>
>>

-- 

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




[web2py] model not updated in scheduled task

2013-05-08 Thread DeanK
So one of my model files is somewhat unique (and possibly a bad idea) and 
causing me problems...I'll try to describe things the best I can.

My application creates tables dynamically based on user input.  To stop 
web2py from defining all the tables on every request (which can be a lot in 
the whole app, but only 10ish per user), I check which tables the user has 
access to and define only those.  This is done by looking at a table 
(projects) where each record specifies other tables that exist (the project 
support tables).

The issue i'm having is the user fills out a form using smartgrid.  In the 
oncreate callback I update the projects table which essentially specifies 
new tables.  These new tables are not defined unless the model runs again. 
 I know this will happen on a refresh, but is there any other way to force 
the models to update?


If I then submit a job to the scheduler that references one of these "new" 
tables I get this error:

'DAL' object has no attribute 'test_project_proj'

Where test_project_proj one of the support tables that should have been defined 
(in the model snippet below project.project_table = 'test_project_proj') .



Example of key part of the model:


user_allowed_ids = get_user_allowed_projects(False) for project in db(db.
projects.id.belongs(user_allowed_ids)).select():
db.define_table(project.project_table,..)
db.define_table(project.block_table,..)
db.define_table(project.metadata_table,..)




I thought that when a job runs on the scheduler it re-runs all the models, so i 
don't understand why the task isn't seeing the new tables.  Thoughts?  Thanks



Dean




-- 

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




[web2py] Re: using scheduler, submitting task from a running task doesn't show up in scheduler_task

2013-04-24 Thread DeanK


> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?


This makes perfect sense.  Also I forget that the "message passing" is 
being done through the database.  I added a db.commit() at the end of the 
parent task and all is right with the world.

You're saving my life today! Thanks,

Dean

 
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>

-- 

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




[web2py] using scheduler, submitting task from a running task doesn't show up in scheduler_task

2013-04-24 Thread DeanK
So I've read through the documentation twice and could have skipped over 
some key point, but i'm having an issue submitting a task from a task.

I've stupefied my to paste it here, but basically from a controller i'm 
doing this:

scheduler.queue_task(my_parent_task,
pvars=dict(arg1=val,arg2=val))



...in scheduler.py:

def my_parent_task(arg1,arg2):
for batch in things_to_do: 
print "submitting job"
r = scheduler.queue_task(my_child_task,
pvars=dict(arg1= arg1,arg2=batch))
print r

return 1


def my_child_task(arg1,arg2):
print "in child task!"
return 1





>From the output of the parent task, if I print the row returned from 
scheduling the child task there are no errors and the tasks get assigned 
ids:

submitting job 
 
submitting job 
 
submitting job



If i look in scheduler_task the parent task id 26 is present but none of 
the child tasks.  If i resubmit my parent task it does in fact get assigned 
ID 30 so mysql is autoincrementing the column. 

Is there something i'm missing again where this is expected behavior?  I'd 
really like to be able to chain tasks together.  Thanks,

Dean


-- 

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




[web2py] Re: using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread DeanK
haha brilliant.  Thanks for the quick response.

My task only operates on the db and internally after an external matlab 
call to chug on data so i wasn't returning anything.  A simple return 1 did 
the trick.

Also I'm using your ComfortScheduler plugin that i found while searching 
the message board.  Thanks for that as well.  So far it works pretty well. 
 I'll send you a message if i run into any issues.

Thanks again,
Dean


On Wednesday, April 24, 2013 2:37:26 PM UTC-4, Niphlod wrote:
>
> it's by design if the function doesn't return a value, then you don't 
> need a record to store the result ^_^
> try returning something from your function and you'll see that the record 
> will remain.
>
> e.g.
> you have
> def mytask():
> # do something
>  
>
>
>
> switch it to
> def mytask():
> #---- do something
> return 1
>
>
>
> On Wednesday, April 24, 2013 8:15:39 PM UTC+2, DeanK wrote:
>>
>> I've been debating using the baked in scheduler and figured I'd try it 
>> out first before fighting to get celery running with web2py.  I have a task 
>> that uses Popen to run an external program, processes the result, and 
>> returns.  When I run this with the scheduler, an entry in scheduler_run is 
>> created.  From what i can tell once the task completes, the entry 
>> disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
>> I have no insight into what just happened since there isn't an entry in 
>> scheduler_run for the task!  Thoughts on what is going on or how to debug? 
>>  Thanks,
>>
>> Dean
>
>

-- 

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




[web2py] using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread DeanK
I've been debating using the baked in scheduler and figured I'd try it out 
first before fighting to get celery running with web2py.  I have a task 
that uses Popen to run an external program, processes the result, and 
returns.  When I run this with the scheduler, an entry in scheduler_run is 
created.  From what i can tell once the task completes, the entry 
disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
I have no insight into what just happened since there isn't an entry in 
scheduler_run for the task!  Thoughts on what is going on or how to debug? 
 Thanks,

Dean

-- 

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




[web2py] Re: smartgrid - limit which fields are editable after creation of record

2013-04-02 Thread DeanK
I didn't understand how smartgrid was using request.args which was my main 
problem. Now that you and massimo pointed it out i've played around and see 
what is going on.  I've got 3 grids in 1 page editing a bunch of tables in 
a controlled fashion with just a few lines of code.  not bad web2py.

Thanks for the response.

Dean

On Tuesday, April 2, 2013 8:32:18 AM UTC-4, Cliff Kachinske wrote:
>
> Dean,
>
> You need to brush up on Python sequences and slicing.
>
> Try this: db.thetable.thefield.writable = (request.args(-2) == 'new')
>
> request.args[0] is valid Python but it returns an index out of range error 
> if request.args is empty.  request.args(0) returns None.  
>
> Same with request.args(-x)
>
> You can always tell what smartgrid is up to by parsing the arg list. 
>  Length of the arg list is significant.  It gets longer when working with 
> child objects.
>
> On Monday, April 1, 2013 11:24:33 PM UTC-4, DeanK wrote:
>>
>> So I'm not sure if I understand this one-liner to properly use it. 
>>  Request.args(-1) doesn't quite make sense to me...i would think you'd have 
>> to index into it starting at 0?
>>
>> If I place the line in the model or in my function that renders the 
>> smartgrid form the field is disabled completely.  If you try to both create 
>> a new record or edit an existing record it is disabled.
>>
>> Again to clarify i'd like to be able to set the field when creating a new 
>> record, but once it has been created you can't edit the field in the 
>> smartgrid (but if you create a new record you can edit again).
>>
>> thanks for your help.
>>
>> On Monday, April 1, 2013 8:18:10 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Yes:
>>>
>>> db.thetable.thefield.writable = (request.args(-1) == 'new')
>>>
>>> On Monday, 1 April 2013 17:31:16 UTC-5, DeanK wrote:
>>>>
>>>> I've been searching and haven't seemed to find someone trying to do 
>>>> this yet.  I'm wondering if there is a way to use the smartgrid, but limit 
>>>> what fields can be edited after you create an entry.  I want to be able to 
>>>> use the smartgrid interface to create a new entry in some tables, but 
>>>> after 
>>>> the user submits and my oncreate callback runs, the user can only edit 
>>>> certain fields via the smartgrid (but still view them all).  Is that 
>>>> possible? 
>>>>
>>>> Thanks,
>>>> Dean
>>>>
>>>

-- 

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




[web2py] Re: smartgrid - limit which fields are editable after creation of record

2013-04-01 Thread DeanK
So I'm not sure if I understand this one-liner to properly use it. 
 Request.args(-1) doesn't quite make sense to me...i would think you'd have 
to index into it starting at 0?

If I place the line in the model or in my function that renders the 
smartgrid form the field is disabled completely.  If you try to both create 
a new record or edit an existing record it is disabled.

Again to clarify i'd like to be able to set the field when creating a new 
record, but once it has been created you can't edit the field in the 
smartgrid (but if you create a new record you can edit again).

thanks for your help.

On Monday, April 1, 2013 8:18:10 PM UTC-4, Massimo Di Pierro wrote:
>
> Yes:
>
> db.thetable.thefield.writable = (request.args(-1) == 'new')
>
> On Monday, 1 April 2013 17:31:16 UTC-5, DeanK wrote:
>>
>> I've been searching and haven't seemed to find someone trying to do this 
>> yet.  I'm wondering if there is a way to use the smartgrid, but limit what 
>> fields can be edited after you create an entry.  I want to be able to use 
>> the smartgrid interface to create a new entry in some tables, but after the 
>> user submits and my oncreate callback runs, the user can only edit certain 
>> fields via the smartgrid (but still view them all).  Is that possible? 
>>
>> Thanks,
>> Dean
>>
>

-- 

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




[web2py] smartgrid - limit which fields are editable after creation of record

2013-04-01 Thread DeanK
I've been searching and haven't seemed to find someone trying to do this 
yet.  I'm wondering if there is a way to use the smartgrid, but limit what 
fields can be edited after you create an entry.  I want to be able to use 
the smartgrid interface to create a new entry in some tables, but after the 
user submits and my oncreate callback runs, the user can only edit certain 
fields via the smartgrid (but still view them all).  Is that possible? 

Thanks,
Dean

-- 

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




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

2013-03-29 Thread DeanK
Thanks.  I could/should have figured most of that out myself so sorry for 
the lame question but I appreciate the quick answer.  Also I talk about 
using Janrain because it exists and works, but all my comments are 
applicable to something that is completely free such as sanction if it was 
integrated.  I'm really just looking for social/oauth integration.  Thanks 
again.

On Friday, March 29, 2013 10:17:05 AM UTC-4, Anthony wrote:
>
> @Anthony - As I said I'm new to web2py and some of the built in stuff is 
>> still a black box to me.  Could you point me to where the auth code is?
>
>
> In order to use Auth, you have to do:
>
> from gluon.tools import Auth
>
> which indicates that the Auth code is in the Auth class within the 
> gluon.tools.py module: 
> https://code.google.com/p/web2py/source/browse/gluon/tools.py#843.
>
> For Janrain, you do:
>
> from gluon.contrib.login_methods.rpx_account import use_janrain
>
> So, that code is here: 
> https://code.google.com/p/web2py/source/browse/gluon/contrib/login_methods/rpx_account.py
> .
>
> Also if I enable Janrain the "register" button disables and I'm not sure 
>> where that behavior comes from.
>
>
> In the 
> use_janrain()function,
>  auth.settings.actions_disabled is set to include 'register'. In 
> fact, you don't want to re-enable this because users are automatically 
> registered the first time they log in with Janrain. You don't want to 
> expose the standard register action because that allows setting a password. 
> Instead, you probably want to direct users to the 'profile' action (or some 
> customized version of it) where they can fill in their name, etc. (some of 
> the social login services may already have filled in the name).
>
> 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: Auth with Janrain but still require "registration"

2013-03-29 Thread DeanK
@Massimo - First of all i'm a new web2py user and I'm really enjoying it so 
far.  The only problem I've had so far is I did my database design in a 
traditional sense before fully understanding the web2py DAL limitations and 
had to redesign things to fit (no compound keys for example).  Overall 
great job and keep up the awesome work.

Regarding this post, from my perspective I like the default auth behavior 
and think you just need to integrate Janrain better.  The only real 
difference here is that instead of maintaining credentials locally, you let 
Janrain handle it (also it's one less password for users to remember).  So 
when registering I imagine you would authenticate via Janrain and then 
redirect to a registration page that lets you collect additional info for 
the user if desired (possibly prepopulated via Janrain).  Log in would be 
modified then to somehow verify that the user has already registered before 
accepting the Janrain token.  If the user hasn't registered (even if 
Janrain accepts their credentials) you redirect to the registration page. 
 Obviously the forgot password functionality would disable automatically.

@Anthony - As I said I'm new to web2py and some of the built in stuff is 
still a black box to me.  Could you point me to where the auth code is? 
Also if I enable Janrain the "register" button disables and I'm not sure 
where that behavior comes from.  Thanks for your help.

Dean

On Thursday, March 28, 2013 11:39:54 AM UTC-4, Anthony wrote:
>
> On Thursday, March 28, 2013 11:06:25 AM UTC-4, DeanK wrote:
>
>> I don't want to have to approve all registrations, but I want to be able 
>> to control when people can register (basically just because you have a 
>> gmail account doesn't mean you can sign in and use the service).  The web 
>> app i'm creating is being rolled out to specific people in a controlled 
>> manner so I need this capability.  I was thinking about having some sort of 
>> "secret early access token" that if you know lets you register before it is 
>> completely open to all users.
>
>
> Sure, that sounds reasonable. Just have the login function check for the 
> token in the URL query string (i.e., via request.vars), and if not present, 
> redirect or return an appropriate message.
>  
>
>> Also I do want to have people fill out some additional information after 
>> the initial Janrain log in.
>>
>
> You can define an auth.settings.login_onaccept function that checks to see 
> whether the required elements of the profile have been filled out yet, and 
> if not, redirect to the profile page.
>
> Anthony
>

-- 

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




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

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

On Wednesday, March 27, 2013 5:38:35 PM UTC-4, Anthony wrote:
>
> Are you saying you want to be able to approve the registrations of users 
> (so just logging in via Janrain isn't enough to allow access), or do you 
> simply want to require users to add to their profile when they first log in 
> with Janrain?
>
> On Wednesday, March 27, 2013 4:08:42 PM UTC-4, DeanK wrote:
>>
>>
>> So I want to be able to use Janrain, but I also want to have people have 
>> to register.  For my app initially i need to control when registration is 
>> open and when it is not, and currently using the examples i've seen, 
>> enabling Janrain makes anyone who can authenticate with one of the third 
>> party provides able to access the app and add an entry to auth_users.
>>
>> This is what did in db.py
>>
>> from gluon.contrib.login_methods.rpx_account import use_janrain
>>
>> auth.settings.actions_disabled=['change_password','request_reset_password']
>> use_janrain(auth, filename='private/janrain.key')
>>
>> Once this is done auth works as descrived above, but the register button 
>> disappears and /default/user/register/ throws a 404.
>>
>> Is there any way to still point to a registration page and make auth only 
>> allow users who already exist when logging in via Janrain?  Ideally 
>> /register would work and essentially after getting a token from Janrain it 
>> would redirect to profile to add additional user info.
>>
>>
>> Thanks,
>> Dean
>>
>

-- 

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




[web2py] Auth with Janrain but still require "registration"

2013-03-27 Thread DeanK

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

This is what did in db.py

from gluon.contrib.login_methods.rpx_account import use_janrain
auth.settings.actions_disabled=['change_password','request_reset_password']
use_janrain(auth, filename='private/janrain.key')

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

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


Thanks,
Dean

-- 

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