Re: [web2py] Re: A bug in _after_insert callback's document (book)? And more.

2015-04-23 Thread Ray (a.k.a. Iceberg)


On Wednesday, April 22, 2015 at 6:56:13 AM UTC-7, Anthony wrote:
>
> It is a different story when building a RESTful API. There would be no 
>> rendering behavior before form submission, and normally I use state-less 
>> HTTP basic auth and then purposely turn off session feature. Unless I force 
>> my api callers to do HTTP POST first, to yet another dedicated "token" api, 
>> which will issue the token and also store it into some backend storage 
>> (such as a DB or central key-value service), blah blah. But this sounds not 
>> "lightweight" at all.
>>
> You could have the client generate its own unique token with each request 
> (e.g., a UUID or timestamp) and cache that on the server for some period of 
> time -- if another request comes in with the same token, then ignore the 
> request and return an appropriate message (perhaps indicating whether a 
> previous request was successful, in case the client didn't receive the 
> success message from an earlier attempt).
>
> Thanks Anthony. That is a very creative idea indeed! I would try to go one 
step further, to let the server to calculate a hash based on request.path 
AND request.vars AND http header date field, so that it would become a 
universal double-submission protection, WITHOUT needing to change the 
client side at all. After all, semantics is important in RESTful api, and 
such UUID is typically not in original api parameters. Of course, all these 
are based on an assumption that there should never be a need to create 2 
fully identical records in one table.

PS: I may not try it anytime soon, because I gonna enable the unique=True 
(and manually create the unique index for my auth_user table) anyway, and 
then I got the protection, for free. Still thanks a lot!

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


Re: [web2py] Re: New error in trunk' s sqlhtml.py: AttributeError: 'SQLCustomType' object has no attribute 'represent'

2015-04-23 Thread Dave S


On Wednesday, April 22, 2015 at 11:56:33 PM UTC-7, Johann Spies wrote:
>
> Apologies for my previous email.  I have read the README again and saw I 
> had to do a "git submodule update --init --recursive". Now it is working.
>
> Where are the days when I could just do a "hg pull; hg update". :)
>
>
There seems to be a lot of love for Git in the world, but the UI doesn't 
seem to be the reason.

>From an admittedly biased mailing list:

Am Donnerstag, 19. März 2015, 09:28:19 schrieb Harvey Chapman:
] In the normal, pull, edit, commit, push cycle, they’re not all that 
different. 
] It’s when things go wrong that mercurial’s simpler, thought-out interface 
really shines. 
] I don’t need to google answers, the mercurial help is really good and is 
easier to understand due to the simpler interface.
  

But you can access github with mercurial:
] he hg-git extension has made this a non-problem: “hg clone 
git+GITHUB_URL”.
(also taken from one of Harvey's posts; he advises setting "intree=True" in 
the [git] section of your .hgrc)

/dps

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


[web2py] Re: How to avoid error when app is renamed and sessions are stored in db and shared through domains?

2015-04-23 Thread Lisandro
I could get it to work, however I'm still concerned about something.
This is what I have and it is working:

session.connect(request, response, db=db, masterapp='init')
response.cookies[response.session_id_name]['domain'] = 'website.com'

As I said before, the two apps were renamed, keeping the database. 
So, regardless the new applications names, the session table is still named 
"web2py_session_init", and that's why I think it is working with 
masterapp='init'.

However, should I be worried about setting masterapp with an app that 
doesn't exist? The book says "If you want two or more applications to share 
sessions, set masterapp to the name of the master application.", but I 
coundn't find specifications about if that app should exist or not.

El jueves, 23 de abril de 2015, 11:36:42 (UTC-3), Lisandro escribió:
>
> I have two apps running on production: "init" app, and "panel" app.
> Both of them are using the same database (symlinked models and databases 
> folder).
> The sessions are stored in the db.
> The main app is "init", so I'm connecting to session like this:
>
> session.connect(request, response, db=db, masterapp='init')
>
> In the database, I can see that the session table is called 
> "web2py_session_init".
>
>
> Now I need to rename both apps and serve both of them on domaind and 
> subdomain, so I did this:
>  - renamed "init" to "*website*"; the app is now served on *website.com 
> * domain.
>  - renamed "panel" to "*website_panel*"; the app is now served on 
> *panel.website.com 
> * domain
>
> The main app now is "website_panel".
>
> In order to mantain sessions through main domain and subdomain, I added 
> this sentence after the session.connect, so I ended up with this:
> session.connect(request, response, db=db, masterapp='init')
> response.cookies[response.session_id_name]['domain'] = 'website.com'
>
> But I'm receiving this error:
>
> Traceback (most recent call last):
>   File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/gonguinguen/medios/applications/website/models/db.py" 
> , line 10, in 
> response.cookies[response.session_id_name]['domain'] = 'website.com'
> KeyError: 'session_id_init'
>
>
>
> First thing I tryied was to change masterapp parameter value, like this:
> session.connect(request, response, db=db, masterapp='website_panel')
> response.cookies[response.session_id_name]['domain'] = 'website.com'
>
> but in this case, an error is raised saying that the table 
> "web2py_session_website_panel" doesn't exists.
> I'm not shure why web2py doesn't create the table. I have migrations 
> enabled,
>
>
> I also tryied manually renaming the table and the corresponding file under 
> databases folder, but in this case I receive the following error:
>
> Traceback (most recent call last):
>   File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/gonguinguen/medios/applications/website/models/db.py" 
> , line 8, in 
> response.cookies[response.session_id_name]['domain'] = 'website.com'
> KeyError: 'session_id_website_panel'
>
>
>
> Also tryied deleting the old session table and the corresponding file 
> under databases folder, but in this case again I receive an error saying 
> that the table "web2py_session_website_panel" doesn't exists. So I'm 
> stucked here. Any tip? Thanks in advance.
>
>

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


[web2py] Re: LOAD() problem: Yes, I am bungling the world's smallest web2py app.

2015-04-23 Thread Tom Campbell
Anthony, thank you thank you thank you! I made these changes as follows and 
it works like a charm.

In default.py
def index():
return locals()

def showtasks():
return dict(grid=SQLFORM.grid(db.task,user_signature=False))



I never considered for a second I would require a controller. I somehow 
thought it was by definition index() that would be the controller, and that 
its view would call another view.

-- 
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: Need support for web2py application with over 1 million users.

2015-04-23 Thread Paolo Valleri
Mind that if you store session in the database/redis you could have 
problems in pages that use components (es: load). Otherwise, it is a good 
starting point.


On Thursday, April 23, 2015 at 6:21:51 PM UTC+2, Derek wrote:
>
> Barring him sharing that information, what general advice can you give 
> regarding this? 
>
> For example, should you store sessions in redis and setup squid and nginx 
> on the hosts? How do you handle the migrations, etc?
>
>
> On Saturday, April 18, 2015 at 8:26:00 PM UTC-7, Massimo Di Pierro wrote:
>>
>> For use to help you we need more info about the architecture. There two 
>> ways you can do this.
>> 1) you can share information on this list and we will all help and 
>> everybody will learn. 2) you can ask for private consulting from one of the 
>> companies that provide web2py support. If you need advice, please contact 
>> me personally.
>>
>> Anyway. Web2py is designed to scale horizontally by adding server behind 
>> a load balancer. You can increase the number of requests per machine by 
>> improving caching. Eventually you hit the database bottleneck. That is a 
>> framework independent problem. If that is the problem you want to look into 
>> optimizing queries. Some times it can be done and some times it cannot. 
>> Some times you have to move to a NoSQL database like Google Cloud Storage 
>> or Mongo. 
>>
>> Massimo
>>
>> On Saturday, 18 April 2015 19:04:54 UTC-5, Sandeep wrote:
>>>
>>> We run major application in India with over 1 million users, and 
>>> relatively high concurrent users traffic, which spikes twice a day. 
>>> Recently we are experiencing a lot of troubles in scaling. We would love to 
>>> get opinion from any consultant who provides support for web2py application 
>>> in India. Any help in this regard would be appreciated. 
>>>
>>

-- 
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: LOAD() problem: Yes, I am bungling the world's smallest web2py app.

2015-04-23 Thread Anthony
You need a showtasks function in your default.py controller -- do you have 
one?

On Thursday, April 23, 2015 at 1:00:50 PM UTC-4, Tom Campbell wrote:
>
> When I run the following no error gets logged but index.html gets the 
> message "invalid function (default/showtasks)" rendered in the view.
>
> Controller in default.py:
> def index():
> return dict(grid=SQLFORM.grid(db.task,user_signature=False))
>
> index.html:
> {{extend 'layout.html'}}
> {{=LOAD('default', 'showtasks.load',ajax=True)}}
>
> default/views/showtasks.load:
> {{if 'message' in globals():}}
> {{=message}}
> {{pass}}
> {{=grid}}
>
>
>

-- 
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] LOAD() problem: Yes, I am bungling the world's smallest web2py app.

2015-04-23 Thread Tom Campbell
When I run the following no error gets logged but index.html gets the 
message "invalid function (default/showtasks)" rendered in the view.

Controller in default.py:
def index():
return dict(grid=SQLFORM.grid(db.task,user_signature=False))

index.html:
{{extend 'layout.html'}}
{{=LOAD('default', 'showtasks.load',ajax=True)}}

default/views/showtasks.load:
{{if 'message' in globals():}}
{{=message}}
{{pass}}
{{=grid}}


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


Re: [web2py] Re: cas and basic auth

2015-04-23 Thread Massimiliano
I don't know why but I found that it work with curl but not with wget.

Someone knows why?

When I'm going to advice to my customer's partner a method to access to the
system what I have to say?

Thank you

On Thu, Apr 23, 2015 at 5:11 PM, Massimiliano  wrote:

> I found that is not cas related, it seem that doesn't work neither in a
> basic app.
>
> Has something to do with this issue?
>
> https://github.com/web2py/web2py/issues/621
>
> Thank you
>
> Massimiliano
>
>
> On Thursday, April 23, 2015 at 3:58:33 PM UTC+2, Massimiliano wrote:
>>
>> Hi,
>>
>> I've a number of applications that use cas to authenticate.
>>
>> Now I need to allow an automatic download for an external integration,
>> but I don't' find a way to make it work.
>>
>> I other word I need that someone download a csv file via wget o somthing
>> like that.
>>
>> I tried:
>>
>> in db.py:
>>
>> auth = Auth(db, cas_provider=myconf.take('auth.cas_provider'))
>> auth.settings.allow_basic_login = True
>> auth.define_tables(username=True)
>>
>> auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
>>
>> and in controller:
>>
>> @auth.requires_login()
>> def give_me_time():
>> import time
>> return time.ctime()
>>
>> Doen't work. I get the login page
>>
>> I Also tried, always from the book:
>>
>> def give_me_time():
>> import time
>> auth.basic()
>> if auth.user:
>> return time.ctime()
>> else:
>> return 'Not authorized'
>>
>>
>> I get always:
>>  Not authorized
>>
>> I there a way to do what I need?
>>
>> Thank you
>> --
>> Massimiliano
>>
>  --
> 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.
>



-- 
Massimiliano

-- 
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: Need support for web2py application with over 1 million users.

2015-04-23 Thread Derek
Barring him sharing that information, what general advice can you give 
regarding this? 

For example, should you store sessions in redis and setup squid and nginx 
on the hosts? How do you handle the migrations, etc?


On Saturday, April 18, 2015 at 8:26:00 PM UTC-7, Massimo Di Pierro wrote:
>
> For use to help you we need more info about the architecture. There two 
> ways you can do this.
> 1) you can share information on this list and we will all help and 
> everybody will learn. 2) you can ask for private consulting from one of the 
> companies that provide web2py support. If you need advice, please contact 
> me personally.
>
> Anyway. Web2py is designed to scale horizontally by adding server behind a 
> load balancer. You can increase the number of requests per machine by 
> improving caching. Eventually you hit the database bottleneck. That is a 
> framework independent problem. If that is the problem you want to look into 
> optimizing queries. Some times it can be done and some times it cannot. 
> Some times you have to move to a NoSQL database like Google Cloud Storage 
> or Mongo. 
>
> Massimo
>
> On Saturday, 18 April 2015 19:04:54 UTC-5, Sandeep wrote:
>>
>> We run major application in India with over 1 million users, and 
>> relatively high concurrent users traffic, which spikes twice a day. 
>> Recently we are experiencing a lot of troubles in scaling. We would love to 
>> get opinion from any consultant who provides support for web2py application 
>> in India. Any help in this regard would be appreciated. 
>>
>

-- 
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] Janrain: NEW OpenID connect

2015-04-23 Thread Stefan van den Eertwegh
Dear fellow web2py users,

I understand that the Janrain plugin in web2py makes use of openID for 
Google Accounts authorization.
Now at the moment we get a warning from the authorization site that google 
doesn't use OpenID anymore and therefore we need to use OpenID Connect.

Is this a change in the web2py codebase that needs to happen or is Janrain 
self supplying web2py with the new way for google Open ID connect 
authorization way?

If anyone knows the answer, i would really appreciate it.

Thanks.

Best regards,
Stefan van den Eertwegh

-- 
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: cas and basic auth

2015-04-23 Thread Massimiliano
I found that is not cas related, it seem that doesn't work neither in a 
basic app.

Has something to do with this issue?

https://github.com/web2py/web2py/issues/621

Thank you

Massimiliano

On Thursday, April 23, 2015 at 3:58:33 PM UTC+2, Massimiliano wrote:
>
> Hi,
>
> I've a number of applications that use cas to authenticate.
>
> Now I need to allow an automatic download for an external integration, but 
> I don't' find a way to make it work.
>
> I other word I need that someone download a csv file via wget o somthing 
> like that.
>
> I tried:
>
> in db.py:
>
> auth = Auth(db, cas_provider=myconf.take('auth.cas_provider'))
> auth.settings.allow_basic_login = True
> auth.define_tables(username=True)
>
> auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
>
> and in controller:
>
> @auth.requires_login()
> def give_me_time():
> import time
> return time.ctime()
>
> Doen't work. I get the login page
>
> I Also tried, always from the book:
>
> def give_me_time():
> import time
> auth.basic()
> if auth.user:
> return time.ctime()
> else:
> return 'Not authorized'
>
> 
> I get always:
>  Not authorized
>
> I there a way to do what I need?
>
> Thank you
> -- 
> Massimiliano
>  

-- 
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] ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.

2015-04-23 Thread Aydin S
I read the solutions for this error, could not resolve it. Before, I had 
the following code in the access.py deleted and everything worked fine.
if request.is_https:
session.secure()
elif not request.is_local and not DEMO_MODE:
raise HTTP(200, T('Admin is disabled because insecure channel'))

Right now, I tried to upgrade to the new version of web2py that everything 
messed up and I get ATTENTION: Login requires a secure (HTTPS) connection 
or running on localhost.
Since I'm running on 0.0.0.0 I understand I need to have https, I tried to 
generate the key and put it in the web2py root folder and run web2py using 
-k key.key -c key-ctr when I do that it even fails to bring the normal 
website up and gives error connection was reset. 
Any help?

-- 
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] IS_MATCH validator bug with unicode

2015-04-23 Thread Alex
Hi,

there is a bug when the IS_MATCH validator is used with is_unicode=True
If the input contains non-ascii characters and is already unicode an 
UnicodeEncodeError occurs:

def __call__(self, value):
if self.is_unicode and not isinstance(value,unicode):
match = self.regex.search(str(value).decode('utf8'))
else:
match = self.regex.search(str(value))


this happens because the else branch is executed. A possible fix:

def __call__(self, value):
if self.is_unicode:
if not isinstance(value,unicode):
match = self.regex.search(str(value).decode('utf8'))
else:
match = self.regex.search(value)
else:
match = self.regex.search(str(value))




Alex

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


[web2py] How to avoid error when app is renamed and sessions are stored in db and shared through domains?

2015-04-23 Thread Lisandro
I have two apps running on production: "init" app, and "panel" app.
Both of them are using the same database (symlinked models and databases 
folder).
The sessions are stored in the db.
The main app is "init", so I'm connecting to session like this:

session.connect(request, response, db=db, masterapp='init')

In the database, I can see that the session table is called 
"web2py_session_init".


Now I need to rename both apps and serve both of them on domaind and 
subdomain, so I did this:
 - renamed "init" to "*website*"; the app is now served on *website.com* 
domain.
 - renamed "panel" to "*website_panel*"; the app is now served on 
*panel.website.com* domain

The main app now is "website_panel".

In order to mantain sessions through main domain and subdomain, I added 
this sentence after the session.connect, so I ended up with this:
session.connect(request, response, db=db, masterapp='init')
response.cookies[response.session_id_name]['domain'] = 'website.com'

But I'm receiving this error:

Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/gonguinguen/medios/applications/website/models/db.py" 
, line 10, in 
response.cookies[response.session_id_name]['domain'] = 'website.com'
KeyError: 'session_id_init'



First thing I tryied was to change masterapp parameter value, like this:
session.connect(request, response, db=db, masterapp='website_panel')
response.cookies[response.session_id_name]['domain'] = 'website.com'

but in this case, an error is raised saying that the table 
"web2py_session_website_panel" doesn't exists.
I'm not shure why web2py doesn't create the table. I have migrations 
enabled,


I also tryied manually renaming the table and the corresponding file under 
databases folder, but in this case I receive the following error:

Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/gonguinguen/medios/applications/website/models/db.py" 
, line 8, in 
response.cookies[response.session_id_name]['domain'] = 'website.com'
KeyError: 'session_id_website_panel'



Also tryied deleting the old session table and the corresponding file under 
databases folder, but in this case again I receive an error saying that the 
table "web2py_session_website_panel" doesn't exists. So I'm stucked here. 
Any tip? Thanks in advance.

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


[web2py] cas and basic auth

2015-04-23 Thread Massimiliano
Hi,

I've a number of applications that use cas to authenticate.

Now I need to allow an automatic download for an external integration, but
I don't' find a way to make it work.

I other word I need that someone download a csv file via wget o somthing
like that.

I tried:

in db.py:

auth = Auth(db, cas_provider=myconf.take('auth.cas_provider'))
auth.settings.allow_basic_login = True
auth.define_tables(username=True)
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']

and in controller:

@auth.requires_login()
def give_me_time():
import time
return time.ctime()

Doen't work. I get the login page

I Also tried, always from the book:

def give_me_time():
import time
auth.basic()
if auth.user:
return time.ctime()
else:
return 'Not authorized'


I get always:
 Not authorized

I there a way to do what I need?

Thank you
-- 
Massimiliano

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