[web2py] Re: login validation
Hi, I don't know about an "is_active" field in auth_user table, only regarding Record versioning, but I don't use it. Regards El lunes, 31 de agosto de 2020 a las 13:05:35 UTC+2, and...@gmail.com escribió: > I noted in the manual. But for your opinion what is the meaning about > is_active in auth_user? > Why is it useful? > Thank you > > > Il giorno lunedì 31 agosto 2020 08:46:15 UTC+2, Paco Bernal ha scritto: >> >> I meant registration_key :) >> >> http://web2py.com/books/default/chapter/29/09/access-control?search=blocked#Access-Control >> >> El lunes, 31 de agosto de 2020 a las 0:08:32 UTC+2, Paco Bernal escribió: >> >>> Hi >>> If you set at anytime key_registration='blocked' in auth_user table that >>> user will not be able to loging. >>> That's the way I would do it >>> Regards >>> >>> El domingo, 30 de agosto de 2020 a las 14:11:08 UTC+2, and...@gmail.com >>> escribió: >>> >>>> Hello, maybe it's easy but I don't know exactly if it's possible. >>>> I want that a user can login ONLY if its rescord has is_valid=True. I >>>> dont' want he logins if is_valid=False in the auth_user table... >>>> Is it possible? In which way? thank you >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/63e215a9-2997-4f9e-9f02-a3b0edc75fecn%40googlegroups.com.
[web2py] Re: login validation
I meant registration_key :) http://web2py.com/books/default/chapter/29/09/access-control?search=blocked#Access-Control El lunes, 31 de agosto de 2020 a las 0:08:32 UTC+2, Paco Bernal escribió: > Hi > If you set at anytime key_registration='blocked' in auth_user table that > user will not be able to loging. > That's the way I would do it > Regards > > El domingo, 30 de agosto de 2020 a las 14:11:08 UTC+2, and...@gmail.com > escribió: > >> Hello, maybe it's easy but I don't know exactly if it's possible. >> I want that a user can login ONLY if its rescord has is_valid=True. I >> dont' want he logins if is_valid=False in the auth_user table... >> Is it possible? In which way? thank you >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3ffd2de3-2eca-4613-a467-6c9018de5082n%40googlegroups.com.
[web2py] Re: login validation
Hi If you set at anytime key_registration='blocked' in auth_user table that user will not be able to loging. That's the way I would do it Regards El domingo, 30 de agosto de 2020 a las 14:11:08 UTC+2, and...@gmail.com escribió: > Hello, maybe it's easy but I don't know exactly if it's possible. > I want that a user can login ONLY if its rescord has is_valid=True. I > dont' want he logins if is_valid=False in the auth_user table... > Is it possible? In which way? thank you > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/22e15707-ab23-440b-89f2-db4382b68965n%40googlegroups.com.
[web2py] Re: Setting a background images with jQuery
Think that this will work for sure, I am using something similar > $(document).ready(function(){ > $(".background2").css("background", "url('{{=URL('static', > 'images/background.jpg)}}')"); > }); > > Well, the code I use is ('body').css({'background-image':'url({{=URL('static','images/%s' % > pic)}})'}); > for showing a random picture in the login screen Regards -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/fa97f3ea-dcc3-4b01-b8de-0d53c582%40googlegroups.com.
[web2py] Setting a background images with jQuery
Maybe you can try with https://domain/static/images/background1.jpg in the array because you need to get the picture from the server and the URL you are using does not point to any picture in front side I think... -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3d1d4ac9-8a04-4ada-989a-3a3aa0cb0d76%40googlegroups.com.
[web2py] Registration key
Hi all Today my mind is a little heavy but can't wait till tomorrow Why db((db.auth_user.registration_key=='')|(db.auth_user.registration_key==None)).count() > gives me 2 and db(db.auth_user.registration_key!='blocked').count() > gives me 1 when I use only 'blocked' to block users? Thanks for the support -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e622dfe5-c639-4dfc-b218-70dc537ea291%40googlegroups.com.
[web2py] Re: Problem passing a json object to controller
H again :) I think the problem is this Instead of request.vars.items[json1] > use this request.vars['items[json1]'] > because the var is 'items[json1]' requests.vars.items[json1] will look for the key 'json1' in the dict var items and there is no items var only a 'items[json1]' var that's why you need to use ['items[json1]'] and not items[json1] Regards El miércoles, 20 de noviembre de 2019, 23:12:45 (UTC+1), Patito Feo escribió: > > Paco here is the reponse: > > >1. {vars: {…}, respuesta: "noexiste"} > 1. respuesta: "noexiste" > 2. vars: {tarea: "solicitudguardar", items[json1]: "[1,2,3]"} > 3. __proto__: Object > > > > Thanks in advance, > > > El miércoles, 20 de noviembre de 2019, 16:39:22 (UTC-5), Paco Bernal > escribió: >> >> Hi, >> >> Try this, write down at the begin of the controller >> >> print request.vars >>> >> >> you will see how the controller receives the information and then you >> will know if it's a js problem or a server side problem. >> >> with your code what the controller receives is >> >> >> '{"make":"Ford","model":"Mustang","year":1969}'}> >>> >> >> you don't need to use json.loads, you just need this >> >>> >>> mydata = request.vars['items[json1]'] >>> print mydata >>> {"make":"Ford","model":"Mustang","year":1969} >>> >> >> Regards from spain Ugly Duckling :) >> >> El miércoles, 20 de noviembre de 2019, 18:08:03 (UTC+1), Patito Feo >> escribió: >>> >>> Hi, >>> >>> Ive been trying to pass an object with keys to the controller. But i >>> havent been able to extract the request.vars. >>> >>> Here is my view: >>> >>> var Cars = {} >>> Cars.make = 'Ford'; >>> Cars.model = 'Mustang'; >>> Cars.year = 1969; >>> >>> $.post( "{{=URL('default', 'transcriptor')}}", //request.post_vars.json1 >>>{ >>> tarea: 'solicitudguardar', items: { json1: JSON.stringify( Cars >>> ) } >>>}, ) >>> >>> >>> Here is my function: >>> >>> elif request.vars.tarea == 'solicitudguardar': >>> >>>var = json.loads ( request.post_vars.items[json1] ) >>> >>> >>> >>> Here is one of the errors i got: >>> >>> global name 'json1' is not defined >>> >>> >>> I dont understand why the array object is not being process as a json >>> array in controller. >>> >>> Any help will be much appreciated. >>> >>> >>> Cheers, >>> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/1ae3295f-cc6c-4863-ab6e-a608f84242fa%40googlegroups.com.
[web2py] Re: Problem passing a json object to controller
Hi, Try this, write down at the begin of the controller print request.vars > you will see how the controller receives the information and then you will know if it's a js problem or a server side problem. with your code what the controller receives is '{"make":"Ford","model":"Mustang","year":1969}'}> > you don't need to use json.loads, you just need this > > mydata = request.vars['items[json1]'] > print mydata > {"make":"Ford","model":"Mustang","year":1969} > Regards from spain Ugly Duckling :) El miércoles, 20 de noviembre de 2019, 18:08:03 (UTC+1), Patito Feo escribió: > > Hi, > > Ive been trying to pass an object with keys to the controller. But i > havent been able to extract the request.vars. > > Here is my view: > > var Cars = {} > Cars.make = 'Ford'; > Cars.model = 'Mustang'; > Cars.year = 1969; > > $.post( "{{=URL('default', 'transcriptor')}}", //request.post_vars.json1 >{ > tarea: 'solicitudguardar', items: { json1: JSON.stringify( Cars ) > } >}, ) > > > Here is my function: > > elif request.vars.tarea == 'solicitudguardar': > >var = json.loads ( request.post_vars.items[json1] ) > > > > Here is one of the errors i got: > > global name 'json1' is not defined > > > I dont understand why the array object is not being process as a json > array in controller. > > Any help will be much appreciated. > > > Cheers, > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/63b3e2b6-3d63-46b0-a7dd-93ee50b3e5ab%40googlegroups.com.
[web2py] Re: upload - can I get the path to original file
HI db.define_table('logos', > Field('logo', 'upload', uploadfolder='applications/%s/%s' % > (request.application, 'uploads'), uploadseparate=True, autodelete=True), > Field('thumbnail', 'upload', uploadfolder='applications/%s/%s' % > (request.application, 'uploads'), uploadseparate=True, autodelete=True, > compute = lambda row: thumb(row.logo, 90, 90, 'logos.logo')), > ) > path = '%suploads/%s/%s/%s' % (request.folder, where, image[start:end], > image) > "where" depends on the field and table names, table logos and field logo and thumb is a module for getting a thumbnail of the picture def thumb( > from gluon import current > import os > from PIL import Image > request = current.request > start = len(where)+1 > end = len(where)+3 > img = Image.open('%suploads/%s/%s/%s' % (request.folder, where, > image[start:end], image)) > img.thumbnail((nx, ny), Image.ANTIALIAS) > root, ext = os.path.splitext(image) > thumb = '%s_%s_%sx%s%s' % (root, name, nx, ny, ext) > img.save('%suploads/%s/%s/%s' % (request.folder, where, > image[start:end], thumb)) > #~ print 'thumb', thumb > return thumb > Regards -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d8d125ae-ea97-40d1-b9e6-14df78016fdf%40googlegroups.com.
[web2py] Re: Ajax Pass ID to Controller Function
Hi ajax('{{=URL('Tools', 'userdelete')}}/'+iduser , [], ''); > Regards -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/6401da79-1dcc-4aae-9e68-5d80dc781119%40googlegroups.com.
[web2py] Re: Determinign what information get displayed based on their content
*Is there a way i could choose what gets displayed in the view & what doesn't get displayed from the database table based on its content using only python??* {{for p in products:}} {{if p.Quantity>0:}} {{=p.whatever}} {{pass}} {{pass}} Two ways for doing that :) -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4f4bb3a3-df6e-4f4c-8674-0e793645379f%40googlegroups.com.
[web2py] Re: Determinign what information get displayed based on their content
* Is there a way i could choose what gets displayed in the view & what > doesn't get displayed from the database table based on its content using > only python??* > > {{for p in products:}} {{=p.whatever}} {{pass}} -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/51ee0ae3-af4e-49dd-91c9-2a91e0cd5dc6%40googlegroups.com.
[web2py] Re: Why is my if/else statement not working
El viernes, 13 de septiembre de 2019, 9:31:23 (UTC+2), mostwanted escribió: > > This conditional statement should be simple & execute without any issues, > I have created a point of Sale system, in a view it shows all the items & > their available quantities, what i want is that when a product's quantity > goes below 10 the quantity figure should turn red & a please refill message > should be displayed but i am not getting this, the if condition is ignored > altogether, only the else statement is executed! > > VIEW CODE > > .refill > { > display: none; > color: red; > font-weight: bold; > padding: 2px; > } > > {{for idx, p in enumerate(products, start=1):}} > > > > $(document).ready(function() >{ > if({{=p.Quantity}} <10) > { > $('span.quantity').css({'color':'red'}); > $('.refill').show(); > } > else > { > $('span.quantity').css({'color':'green'}); > $('.refill').hide(); > } > }); > > {{pass}} > {{=idx}} > {{=p.Quantity}} Please Refill > ... > ... > ... > ... > ... > ... > > Please assist > > Regards; > > > Mostwanted > Maybe this can help .refill { color: red; font-weight: bold; padding: 2px; } .bold15 { font-weight: bold; font-size: 15px; } .red { color: red; } .green { color: green; } {{for idx, p in enumerate(products, start=1):}} {{=idx}} {{=p.Quantity}} Please Refill {{pass}} Regards -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/95e67ae9-5dbe-4200-b139-57a46ab60280%40googlegroups.com.
[web2py] Re: Automatic user logout & redirect
redirect(URL('index'), client_side=True) -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/70fdad1e-6e33-40cc-be51-b2106ee2ab8f%40googlegroups.com.
[web2py] Re: Pass variable from JavaScript function to controller: Using JSQueryBuilder
Hi ajax('{{=URL('default', 'showfilters')}}' + '?result1=' + result1 + '='+result2, [], ':eval'); result1 = request.vars.result1 result2 = request.vars.result2 or ajax('{{=URL('default', 'showfilters')}}/' + result1 + '/' + result2, [], ':eval'); result1 = request.args(0) result2 = request.args(1) to will need to take care about the strings you pass to the url or you will bad results back to the app. ajax('{{=URL('default','save_user')}}/'+agent_id+'?first_name='+encodeURIComponent($('#first_name').val())+'_name='+encodeURIComponent($('#last_name').val())+'='+encodeURIComponent($('#email').val())+'='+encodeURIComponent($('#phone').val()),[],':eval'); > Regards El jueves, 1 de agosto de 2019, 3:32:40 (UTC+2), Aydin escribió: > > Anthony, how to pass multiple variables, say result1 and result2? > > On Thursday, September 22, 2016 at 2:18:01 PM UTC-4, Anthony wrote: >> >> "result" is a Javascript variable, so it does not exist in the Python >> context in which the URL() function is evaluated. Instead, you must add >> that part of the URL via Javascript: >> >> ajax('{{=URL('default', 'showfilters')}}' + '?result=' + result, [], >> ':eval'); >> >> Anthony >> >> On Thursday, September 22, 2016 at 8:49:47 AM UTC-4, Madhavi wrote: >>> >>> Hi, >>> >>> >>> >>> I am trying to use JavaScript Query Builder plugin (querybuilder.js.org) >>> with web2py. The plugin is installed successfully and I can see the >>> querybuilder object in my view. I want to finally pass the string >>> containing the filters selected from the view to another controller >>> function for further processing. The code I am using on the view is below: >>> >>> >>> >>> Get rules >>> >>> >>> >>> function myFunction();{ >>> >>> var result = >>> JSON.stringify($('#builder-basic').queryBuilder('getRules'), null, 2); >>> >>> ajax('{{=URL('default', 'showfilters', >>> vars=dict(result=result))}}', [], ':eval'); >>> >>> } >>> >>> >>> >>> >>> >>> I want to pass ‘result’ variable to ‘showfilters’ controller function >>> and call ‘showfilters’ view on clicking on ‘Get rules’ button. But the >>> above code doesn’t work and gives this error: >>> >>> * name 'result' is not defined* >>> >>> I understand this could be because 'result' variable is not defined in >>> my controller function corresponding to this view. What is the correct way >>> to pass the value of a variable declared through Java Script to a >>> controller function in web2py? >>> >>> Please help me here – I am novice to both web2py and Java Script and >>> have been struggling with this for quite some time. I would prefer to pass >>> the variable result through dictionary and not as an argument, as it will >>> contain spaces and special characters which I want to preserve in the >>> string. >>> >>> Thanks, >>> >>> Madhavi >>> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b4b76238-b689-422c-af77-85537e5e3d6a%40googlegroups.com.
[web2py] Re: Hosting question
Thank you, Now it's working as spected. appconfig.ini [host] > names = subdomain:* > I removed the virtualhost regarding the dedicated ips and set DocumentRoot in port 80 for my subdomain to /dev/null Not sure if it's the right way but it's working now without expliciting having a virtualhost for each ip to avoid ip direct access. About nginx, of course it's much better, but old customs are hard to avoid :) Regards El jueves, 1 de agosto de 2019, 12:00:01 (UTC+2), Dave S escribió: > > > > On Thursday, August 1, 2019 at 1:37:37 AM UTC-7, Jose C wrote: >> >> I use Lets encrypt certificates and redirecting from 80 to 443, and I >>> don't touch virtualhost file in port 80 so for sure, i'm doing something >>> wrong with apache3 and for sure with host names in appconfig.ini >>> >>> [host] names = localhost:*, 127.0.0.1:*, *:*, * >> That is worrying. I can only suspect some kind of misconfiguration with >> apache to be causing this. Unfortunately I know nothing about apache conf >> so can't help. I'd recommend creating a new post with this issue you're >> having... one of the more knowledgeable folks might be able to help you >> figure out what is going on. >> > > I'd agree that it is an Apache issue. With my Nginx configuration, I get > the expected "invalid function" response from web2py. > > The group wisdom seems to be that Apache setup is arcane and complicated, > and Massimo and others explicitly recommend Nginx for production. If you > are constrained to Apache, though, that could be tough. And I'm no help > there. > > /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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/98e74b5e-bc06-4ef3-9dbf-f3d10502a36f%40googlegroups.com.
[web2py] Re: Hosting question
Yes, I discovered a few days ago that private folder can be accessed using the vps ip, so I have been playing with host names in appconfig.ini and with apache2 configuration and the only way to stop accessing private folder was adding a new virtualhost in apache for each vps ip with this: > Redirect 403 / > ErrorDocument 403 "Sorry, direct IP access not allowed." > DocumentRoot /dev/null > UseCanonicalName Off > > > I use Lets encrypt certificates and redirecting from 80 to 443, and I don't touch virtualhost file in port 80 so for sure, i'm doing something wrong with apache3 and for sure with host names in appconfig.ini [host] > names = localhost:*, 127.0.0.1:*, *:*, * > > Regards El jueves, 1 de agosto de 2019, 9:26:26 (UTC+2), Jose C escribió: > > > I added the line in routes.py - While it restricts allowing >> access to other applications like welcome it does not restrict >> redirection - so in my case it still redirected to welcome application >> mentioning something is wrong message. >> >> Odd. I have a similar setup to you with multiple domains, 2.18.5, py3 > using rocket server. If I do not place 'welcome' in the 'allowed_apps' > any attempt to get to any page on the welcome app returns a 404 (as > expected). > One thing that may be different... I have additional parameters in > routes.py which specifies the default for each app... perhaps in the > absence of this it tries to go back to 'welcome'? > > routers = dict( > # base router > BASE = dict( > domains={'domain1.com' : 'app1', > 'domain2.com' : 'app2', > }, > default_application = 'app1', > applications = ['app1', 'app2'], > default_function = 'home', > ), > app1 = dict( > default_language = 'en', > languages = ['en'], > default_function = 'home', > ), > app2 = dict( > default_language = 'en', > languages = ['en'], > default_function = 'index', > map_hyphen = True, > ), > > > ) > > Paco: Surely appconfig.ini should never be reachable via the url due to > the security risks of allowing access to config info? I paniced for a sec > and tried accessing mine with a link like yours but get 404 (as expected). > Are you saying you can see your appconfig.ini, without specifically doing > something to expose it, by simply accessing a link the way you formatted > it? > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b617507e-06b5-423d-b007-04f98734c101%40googlegroups.com.
[web2py] Hosting question
Hi Please can you test this url and tell me what you have as result? http://vps_ip/applications/app1/private/appconfig.ini Change vps_ip for the ip of your server and app1 for the name of your application (folder name) Thx -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/34e00c8d-08df-47d1-9f16-b51924728617%40googlegroups.com.
[web2py] Re: Why URL(..., scheme=True, ...) is implemented differently than request.is_https?
That's totally right. I'm terrible sorry about my answer, I was crazy the last four weeks at work, sorry, quick and bad help, no help at all, my fault. El miércoles, 17 de julio de 2019, 9:45:24 (UTC+2), Ray (a.k.a. Iceberg) escribió: > > The problem is NOT about how to setup apache to redirect http to https. I > am already doing that. But, in fact, it was such a redirection, combining > with the unfortunate fact that web2py's URL(..., scheme=True) still > generating "http://...; links, causing my RESTful API to malfunction. Who > would know an http PUT request would lost its http body after a > redirection? Nonetheless, in my previous post, I already narrowed down to > the root cause, and asked: why URL(..., scheme=True) is currently > implemented as detecting wsgi_url_scheme env var, rather than simply > relying on the more sophisicated request.is_https? > > Regards, > Ray > > On Tuesday, July 16, 2019 at 2:18:45 PM UTC-7, Paco Bernal wrote: >> >> You can always redirect apache from http to https > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/7567e4ee-0834-40a0-be7a-f99f70b6b022%40googlegroups.com.
[web2py] Re: Anthony was right... web3py has a big naming conflict
And the winner is ??? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/05fc9d0f-9ba9-46fd-91ac-729656f2cb00%40googlegroups.com.
[web2py] Anthony was right... web3py has a big naming conflict
What about web2py3 ? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/39f3c95d-4c86-4145-ac43-d4e789f626cf%40googlegroups.com.
[web2py] Why URL(..., scheme=True, ...) is implemented differently than request.is_https?
You can always redirect apache from http to https -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/eac9e3f1-f470-4cfe-8637-92b538477ec0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: New International Telegram Support Group
I just joined the group. Great to be here Thx 2 all and join the group please -- 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: the ajax callback action return a list [URGENT]
In server side when rendering the view you use python vars with {{=my_python_var}} If you are asking how to use a python var in client side with javascript you can use ASSIGNJS(js_var=python_var) Take a look at the files I uploaded before. def mycontroller(): . return ASSIGNJS(js_var=python_list) if you use ':eval' you will have a new js_var var to use with javascript. if you use a view to fill a div you can do the same thing, but then you will return dict(whatever=whatever) and in the view you can use {{=ASSIGN(js_var=whatever)}} inside a script tag. El jueves, 1 de junio de 2017, 15:44:06 (UTC+2), sunda...@gmail.com escribió: > > I totally agree with that but then how do you use that list in the view > as a python variable ??? > > Le jeudi 1 juin 2017 09:09:15 UTC+2, Junior Phanter a écrit : >> >> >> var list_sunda = ""; >> ajax("your_echo_url", [], ':eval'); >> >> >> def echo_url(): >> list_sunda=[1,2,3,4,5] >> return "list_sunda=%s;" %list_sunda >> >> 2017-06-01 3:49 GMT-03:00: >> >>> Hey paco, >>> >>> the problem is that i am using script, so the the action in the >>> controller is a callback, it means that it dont have his html page. >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: the ajax callback action return a list [URGENT]
But what are you returning in the controller?? El jueves, 1 de junio de 2017, 8:49:46 (UTC+2), sunda...@gmail.com escribió: > > Hey paco, > > the problem is that i am using script, so the the action in the controller > is a callback, it means that it dont have his html page. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: the ajax callback action return a list [URGENT]
Here you have an example about what I told you without using ':eval' It's easier to user alert('{{=client_details.name}}'); of course, it's only to show you ASSIGNJS and that you always can do things in many several ways :) El martes, 30 de mayo de 2017, 14:46:08 (UTC+2), sunda...@gmail.com escribió: > > > In my controller, i have a list which i called tools which containes > values. > > I would like to return this list like you said. > > In my view i would like to retrieve the value and to put the values inside > variable( with loop i think) > > But when i put eval and i call the function javascription from the > controler : the name of the list is displayed ( it takes the string and not > the content :'( ) > -- 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. # -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations # - # This is a sample controller # - index is the default action of any application # - user is required for authentication and authorization # - download is for downloading files uploaded in the db (does streaming) # - # -- def index(): clients_names = db(db.clients).select(db.clients.name, orderby=db.clients.name) return dict(clients_names=clients_names) # -- def client_details(): client_name = request.args(0) if client_name: client_details = db(db.clients.name==client_name).select().first() if client_details: return dict(client_details=client_details) return redirect(URL('default','index'), client_side=True) # -- def user(): """ exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/bulk_register use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control also notice there is http:///[app]/appadmin/manage/auth to allow administrator to manage users """ return dict(form=auth()) @cache.action() def download(): """ allows downloading of uploaded files http:///[app]/default/download/[filename] """ return response.download(request, db) def call(): """ exposes services. for example: http:///[app]/default/call/jsonrpc decorate with @services.jsonrpc the functions to expose supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv """ return service() # -*- coding: utf-8 -*- # - # This scaffolding model makes your app work on Google App Engine too # File is released under public domain and you can use without limitations # - if request.global_settings.web2py_version < "2.14.1": raise HTTP(500, "Requires web2py 2.13.3 or newer") # - # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # - # request.requires_https() # - # app configuration made easy. Look inside private/appconfig.ini # - from gluon.contrib.appconfig import AppConfig # - # once in production, remove reload=True to gain full speed # - myconf = AppConfig(reload=True) if not request.env.web2py_runtime_gae: # - # if NOT running on Google App Engine use SQLite or other DB # - db = DAL(myconf.get('db.uri'), pool_size=myconf.get('db.pool_size'), migrate_enabled=myconf.get('db.migrate'), check_reserved=['all']) else: #
[web2py] Re: the ajax callback action return a list [URGENT]
mmm... maybe you are looking for ASSIGNJS(js_var=python_list) It depends on the way you want to do whatever you wanna do :) if you get the name of the list is because you *return dict(your_list=your_list)* and in the view you have* {{=your_list}} *you need to *return ASSIGNJS(my_js_var=your_list}}* and in the view you can manage my_js_var with javascript. But you can use the other case instead of ':eval' that will return the view you have for that controller, inside a div and then represent the information as you want and with your own js script for that view. El martes, 30 de mayo de 2017, 14:46:08 (UTC+2), sunda...@gmail.com escribió: > > > In my controller, i have a list which i called tools which containes > values. > > I would like to return this list like you said. > > In my view i would like to retrieve the value and to put the values inside > variable( with loop i think) > > But when i put eval and i call the function javascription from the > controler : the name of the list is displayed ( it takes the string and not > the content :'( ) > -- 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: the ajax callback action return a list [URGENT]
Or you can use ':eval' as the third argument as Anthony says and return '%s%s' % (ASIGNJS(your_js_var=your_python_list), 'your_js_code_for_manipulating_the_list') This way you can manipulate your list with js in client side, but I prefer using a view if the html code is more than one or two lines :) El miércoles, 24 de mayo de 2017, 10:23:05 (UTC+2), sunda...@gmail.com escribió: > > Hello, > > > i have a form, when i fill it, it will callback an ajax code, which will > call an action, that action returns a list and it puts it on the target, > > I can see the target when i put And it display > the list perfectly ... > > The problem is that i don't wan't the list being displayed, i just want to > work with it in the view, i would like to be able to have the list in the > view without having to pass by a div. > > > > > 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: the ajax callback action return a list [URGENT]
You have to use a view to work with the list returned by the function. Both, the view and the funcion with the same name or using response.view="view_name.html" El miércoles, 24 de mayo de 2017, 10:23:05 (UTC+2), sunda...@gmail.com escribió: > > Hello, > > > i have a form, when i fill it, it will callback an ajax code, which will > call an action, that action returns a list and it puts it on the target, > > I can see the target when i put And it display > the list perfectly ... > > The problem is that i don't wan't the list being displayed, i just want to > work with it in the view, i would like to be able to have the list in the > view without having to pass by a div. > > > > > 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: Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user
Good point, for sure I think is always better to give clear information to the users, they don't use to read manuals or to do logical things by the way.. redirecting without telling "why" may be confusing :) El miércoles, 12 de abril de 2017, 13:17:06 (UTC+2), Massimo Di Pierro escribió: > > You may want to return something even if not auth.user. > > On Saturday, 1 April 2017 12:03:55 UTC-5, Paco Bernal wrote: >> >> Sorry I lost my own question for almost a year :S >> >> Finally I was doing this: >> >> def get_index(): >> if not auth.user: >> return 'Your session has expired, you have to %s again.' % A( >> 'login', _href=URL('user', 'login')) >> >> >> >> or >> >> def get_index(): >> if not auth.user: >> return "jQuery('#details').html('Your session has expired, you >> have to %s again.');" % A('login', _href=URL('user', 'login')) >> >> >> >> So the message was showed in the "details" div with the link to log in >> again, *but your answer is what I really was looking for, thanks.* >> >> Why can I not use >> >> @auth.requires_login(otherwise=URL('log_again')) >> >> >> >> in tools.py, if login_required and not user and current.request.ajax then >> raise 401 before checking for otherwise to redirect. >> >> if login_required: >> if not user: >> if current.request.ajax: >> raise HTTP(401, self.messages.ajax_failed_authentication) >> elif otherwise is not None: >> if callable(otherwise): >> return otherwise() >> redirect(otherwise) >> >> I even tried to use user_signature in ajax calls (js in views) with >> @auth.requires_signature() but I think I missunderstood something about >> that, no luck. >> >> Thanks >> >> El domingo, 19 de junio de 2016, 6:33:47 (UTC+2), Anthony escribió: >>> >>> What you are doing is roughly equivalent to just doing: >>> >>> redirect(URL('default', 'user', args='login'), client_side=True) >>> >>> When you call redirect during an Ajax request, setting client_side=True >>> causes the parent window to redirect (via Javascript). So, you could do >>> something like: >>> >>> def get_index(): >>> if not auth.user: >>> redirect(URL('default', 'user', args='login'), client_side=True) >>> if not auth.has_membership('role'): >>> raise HTTP(403, ...) >>> >>> >> >> >> >>> Anthony >>> >>> >>> On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Paco Bernal wrote:Hi all, >>> >>> This is my first question here, although I use it sometimes to read a >>> few questions that I make to myself when coding using this cool and great >>> tool. Thanks. >>> >>> A few months ago I started to use ajax to fill middle column of screen >>> from clicks (interaction with the user) in the left sidebar and sometimes >>> to show right side bar with more info when interacting with middel column. >>> Maybe looking for ways to opotimaze data flow in the network and from the >>> server, and for learning. >>> >>> Something like this: >>> >>> ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], >>> 'div_target'); >>> >>> But when the user lose his session (you can delete cookies for example) >>> because of ajax to fill a div, nothing happens when the user clicks on the >>> left side bar, no error and no redirect to user login even with >>> @auth.requires_membership('roll') in defs inside the controller. >>> >>> So, the only way I found is to add these lines at the beginning of the >>> controller : >>> >>> #-- >>> if not auth.user and not session.not_auth: >>> session.not_auth = True >>> redirect (URL('not_auth')) >>> #-- >>> def not_auth(): >>> session.not_auth = None >>> return dict() >>> #-- >>> >>> and the view, no_auth.html: >>> >>> {{include 'web2py_ajax.html'}} >>> >>> $( document ).ready(function() { >>> $(location).attr('href', '{{=URL('user','login')}}'); >>> }); >>> >>> >>> The question is, is there any other more elegant way (or not) to do the >>> same? >>> >>> 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: Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user
Sorry I lost my own question for almost a yer :S Finally I was doing this: def get_index(): if not auth.user: return 'Your session has expired, you have to %s again.' % A('login' , _href=URL('user', 'login')) or def remove_ref_blacklisted(): if not auth.user: return "jQuery('#details').html('Your session has expired, you have to %s again.');" % A('login', _href=URL('user', 'login')) So the message was showed in the "details" div with the link to log in again, *but your answer is what I really was looking for, thanks.* Why can I not use @auth.requires_login(otherwise=URL('log_again')) in tools.py, if login_required and not user and current.request.ajax then raise 401 before checking for otherwise to redirect. if login_required: if not user: if current.request.ajax: raise HTTP(401, self.messages.ajax_failed_authentication) elif otherwise is not None: if callable(otherwise): return otherwise() redirect(otherwise) I even tried to use user_signature in ajax calls (js in views) with @auth.requires_signature() but I think I missunderstood something about that, no luck. Thanks El domingo, 19 de junio de 2016, 6:33:47 (UTC+2), Anthony escribió: > > What you are doing is roughly equivalent to just doing: > > redirect(URL('default', 'user', args='login'), client_side=True) > > When you call redirect during an Ajax request, setting client_side=True > causes the parent window to redirect (via Javascript). So, you could do > something like: > > def get_index(): > if not auth.user: > redirect(URL('default', 'user', args='login'), client_side=True) > if not auth.has_membership('role'): > raise HTTP(403, ...) > > > Anthony > > > On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Paco Bernal wrote:Hi all, > > This is my first question here, although I use it sometimes to read a few > questions that I make to myself when coding using this cool and great tool. > Thanks. > > A few months ago I started to use ajax to fill middle column of screen > from clicks (interaction with the user) in the left sidebar and sometimes > to show right side bar with more info when interacting with middel column. > Maybe looking for ways to opotimaze data flow in the network and from the > server, and for learning. > > Something like this: > > ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], > 'div_target'); > > But when the user lose his session (you can delete cookies for example) > because of ajax to fill a div, nothing happens when the user clicks on the > left side bar, no error and no redirect to user login even with > @auth.requires_membership('roll') in defs inside the controller. > > So, the only way I found is to add these lines at the beginning of the > controller : > > #-- > if not auth.user and not session.not_auth: > session.not_auth = True > redirect (URL('not_auth')) > #-- > def not_auth(): > session.not_auth = None > return dict() > #-- > > and the view, no_auth.html: > > {{include 'web2py_ajax.html'}} > > $( document ).ready(function() { > $(location).attr('href', '{{=URL('user','login')}}'); > }); > > > The question is, is there any other more elegant way (or not) to do the > same? > > 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: Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user
Sorry I lost my own question for almost a year :S Finally I was doing this: def get_index(): if not auth.user: return 'Your session has expired, you have to %s again.' % A('login', _href=URL('user', 'login')) El domingo, 19 de junio de 2016, 6:33:47 (UTC+2), Anthony escribió: > > What you are doing is roughly equivalent to just doing: > > redirect(URL('default', 'user', args='login'), client_side=True) > > When you call redirect during an Ajax request, setting client_side=True > causes the parent window to redirect (via Javascript). So, you could do > something like: > > def get_index(): > if not auth.user: > redirect(URL('default', 'user', args='login'), client_side=True) > if not auth.has_membership('role'): > raise HTTP(403, ...) > > Anthony > > > On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Paco Bernal wrote:Hi all, > > This is my first question here, although I use it sometimes to read a few > questions that I make to myself when coding using this cool and great tool. > Thanks. > > A few months ago I started to use ajax to fill middle column of screen > from clicks (interaction with the user) in the left sidebar and sometimes > to show right side bar with more info when interacting with middel column. > Maybe looking for ways to opotimaze data flow in the network and from the > server, and for learning. > > Something like this: > > ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], > 'div_target'); > > But when the user lose his session (you can delete cookies for example) > because of ajax to fill a div, nothing happens when the user clicks on the > left side bar, no error and no redirect to user login even with > @auth.requires_membership('roll') in defs inside the controller. > > So, the only way I found is to add these lines at the beginning of the > controller : > > #-- > if not auth.user and not session.not_auth: > session.not_auth = True > redirect (URL('not_auth')) > #-- > def not_auth(): > session.not_auth = None > return dict() > #-- > > and the view, no_auth.html: > > {{include 'web2py_ajax.html'}} > > $( document ).ready(function() { > $(location).attr('href', '{{=URL('user','login')}}'); > }); > > > The question is, is there any other more elegant way (or not) to do the > same? > > 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] Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user
Hi all, This is my first question here, although I use it sometimes to read a few questions that I make to myself when coding using this cool and great tool. Thanks. A few months ago I started to use ajax to fill middle column of screen from clicks (interaction with the user) in the left sidebar and sometimes to show right side bar with more info when interacting with middel column. Maybe looking for ways to opotimaze data flow in the network and from the server, and for learning. Something like this: ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], 'div_target'); But when the user lose his session (you can delete cookies for example) because of ajax to fill a div, nothing happens when the user clicks on the left side bar, no error and no redirect to user login even with @auth.requires_membership('roll') in defs inside the controller. So, the only way I found is to add these lines at the beginning of the controller : #-- if not auth.user and not session.not_auth: session.not_auth = True redirect (URL('not_auth')) #-- def not_auth(): session.not_auth = None return dict() #-- and the view, no_auth.html: {{include 'web2py_ajax.html'}} $( document ).ready(function() { $(location).attr('href', '{{=URL('user','login')}}'); }); The question is, is there any other more elegant way (or not) to do the same? 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.