Re: [web2py] Re: LOAD in py4web

2022-02-17 Thread cdbaron
Thanks a lot.

I'll try load_and_trap, but I think htmx may be better. I will look at your 
applications.

El jueves, 17 de febrero de 2022 a las 0:10:33 UTC+1, Jim S escribió:

> See this thread for how to replicate LOAD in py4web - 
> https://groups.google.com/u/1/g/py4web/c/EUpv9IRJ_eo/m/niHzrnR5AwAJ
>
> In short, use load_and_trap from utils.js.
>
> I was using this for a while but then transitioned to doing all my 
> reactive-type functions using htmx.  https://htmx.org
>
> Check out my py4web htmx demo - 
> https://github.com/jpsteil/py4web_htmx_demo
>
> or my sample SouthBreeze application 
> https://github.com/jpsteil/southbreeze  for examples.
>
> htmx is amazing
>
> NOTE - demos might now work with the latest py4web from github.  There are 
> some changes I need to apply to my code that I haven't gotten to yet.
>
> Can anyone else address the "A" and "URL" questions?
>
> -Jim
>
>
> On Tuesday, February 15, 2022 at 3:47:24 PM UTC-6 cdbaron wrote:
>
>> I have several projects with web2py and I have already started to study 
>> the possibility of migrating to py4web.
>>
>> They are all rendered on the server side and for now I want to keep it 
>> that way.
>>
>> I see some challenges that make me a little scared:
>>
>> *LOAD
>> * A Helper: (many times with the callback parameter and others with _href)
>> * URL: With user_signature=True for links with callback
>>
>> I use hundreds of times A and URL and a little less LOAD
>>
>> For none of these functions or helpers have I found a direct replacement 
>> in py4web.
>>
>> LOAD does not exist in py4web, A does not have the possibility of ajax 
>> calls with the callback parameter and URL is totally different in py4web.
>>
>> It would be great to see some of this web2py magic carried over to py4web.
>>
>> El domingo, 6 de febrero de 2022 a las 15:37:49 UTC+1, vinid...@gmail.com 
>> escribió:
>>
>>> Have you managed to make a welcome template based on Unpoly?
>>>
>>> On Wednesday, March 4, 2020 at 8:37:51 PM UTC+7 yamand...@gmail.com 
>>> wrote:
>>>
>>>> Sorry for the typo.
>>>> I want to make a welcome template based on unpoly soon.
>>>>
>>>> Em sex., 28 de fev. de 2020 às 04:21, AGRogers  
>>>> escreveu:
>>>>
>>>>> https://unpoly.com/  
>>>>>
>>>>> On Fri, 28 Feb 2020 at 16:22, Massimo Di Pierro  
>>>>> wrote:
>>>>>
>>>>>> never heard of unpolly.js and cannot find it. Have a link?
>>>>>>
>>>>>>
>>>>>> On Wednesday, 26 February 2020 19:32:20 UTC-8, Carlos Costa wrote:
>>>>>>>
>>>>>>> LOAD is a very cool thing! And beginners just say WOW when they can 
>>>>>>> create ajax-like experience so easy.
>>>>>>> But, IMO, it lacks some important features for modern apps, like 
>>>>>>> error handling and history handling.
>>>>>>>
>>>>>>> I have written some simple functions to help cover these things...
>>>>>>>
>>>>>>> Another way I found very useful was to use unpolly.js. It's magic 
>>>>>>> but makes me a little lazyer about getting things done with vue.js.
>>>>>>> (BTW they created unpolly to avoid using things like vue, react, 
>>>>>>> etc, really!)
>>>>>>>
>>>>>>> I would like very much to use vue.js but I am still noob regarding 
>>>>>>> how to use it with py4web.
>>>>>>> Maybe we should really encourage vue.js and stuff alike... but an 
>>>>>>> initial pattern would be cool.
>>>>>>> And IMO it should be simple and very cleared stated in the docs.
>>>>>>> So no one will miss LOAD.
>>>>>>>
>>>>>>> Em domingo, 23 de fevereiro de 2020 15:18:51 UTC-3, RHC escreveu:
>>>>>>>>
>>>>>>>> HI,
>>>>>>>>
>>>>>>>> I am beginning to experiment with py4web, I like the sound of it 
>>>>>>>> and I am looking to convert a web2py project to py4web to see how they 
>>>>>>>> compare.
>>>>>>>>
>>>>>>>> It appears that the LOAD (helper?) that was available in web2py 
>>>>>>>> templates is not available in py4web.

[web2py] Re: wev2py 2.22.1 is out

2022-02-17 Thread cdbaron
Hello,

Now it's working fine!

Thank you very much, you are doing an amazing job.

El miércoles, 16 de febrero de 2022 a las 22:19:21 UTC+1, Leonel Câmara 
escribió:

> Link for the potential fix
> https://github.com/web2py/web2py/pull/2430
>
> A quarta-feira, 16 de fevereiro de 2022 à(s) 21:18:48 UTC, Leonel Câmara 
> escreveu:
>
>> @cdbaron this was a sneaky one, but I've found it. I actually think this 
>> one is a very old bug from 2016 and I think it might be affecting my 
>> applications as well. 
>>
>>
>> A segunda-feira, 14 de fevereiro de 2022 à(s) 17:39:21 UTC, cdbaron 
>> escreveu:
>>
>>> Hi Massimo,
>>>
>>> Thanks for replying, this issue is driving me a little crazy...
>>>
>>> * I noticed the change in behavior when updating from Version 
>>> 2.19.1-stable to the github version of the end of December 2021 (before 
>>> version 2.22.1)
>>> * After this, I downloaded version 2.21.1 from web2py.com and it worked 
>>> fine.
>>> * Then with version 2.22.1 I continue with this problem.
>>> * Yes, this behavior change was only detected when I declared a default 
>>> application in routes.py in the root directory of web2py.
>>> * Yes, if I upload a file the download link doesn't work, and the form 
>>> itself can't display the image.
>>> * The file is uploaded correctly and is in the correct directory.
>>> * If I delete the routes.py file everything works fine and the file that 
>>> I uploaded when I had declared the default application can be downloaded 
>>> without problems, the link (with the name of the application in the url) 
>>> works fine.
>>> * one more thing, when I have the default application declared, if I 
>>> upload an image with a.jpeg filename everything works fine, with any other 
>>> aa.jpeg filename for example the download link gives me a 400 error.
>>>
>>> I'm going to try to attach a zip file to a simple example application. A 
>>> single table with a single field and a controller with a single function 
>>> that creates a form.
>>>
>>> https://www.dropbox.com/s/46bu3wjhjexathu/myapp.zip?dl=0
>>>
>>>
>>> El domingo, 13 de febrero de 2022 a las 22:44:19 UTC+1, Massimo Di 
>>> Pierro escribió:
>>>
>>>> I am very confused by this. I cannot find any change that could cause 
>>>> this change of behavior. Let me summarize to make sure I am understanding.
>>>>
>>>> You observed a change of behavior between 2.21.1 and 2.22 1.
>>>> The change of behavior only manifests when you declare a default app in 
>>>> routers.py
>>>> The change of behavior consists of the fact that, if you upload a file 
>>>> using a form, the link to download the file does not work.
>>>> You can confirm that the file is there and the link works if no default 
>>>> app in routers is provided.
>>>>
>>>> Is this all correct? If yes. I will debug more. If you could provide a 
>>>> minimalist app to reproduce it would save me some time.
>>>>
>>>> Massimo
>>>>
>>>>
>>>>
>>>> On Wednesday, 9 February 2022 at 07:21:40 UTC-8 cdbaron wrote:
>>>>
>>>>> Now from github I can successfully download web2py.
>>>>>
>>>>> But I have a problem with a form with a field of type upload.
>>>>>
>>>>> With web2py 2.21.1 it works fine, but with version 2.22.1 it doesn't 
>>>>> work. I have tested with python 3.7 and 3.8
>>>>>
>>>>> I already posted a query a few days ago, but I haven't had any 
>>>>> response, I apologize for posting the same thing again.
>>>>>
>>>>> When I upload any image with a form, for example the one below, when 
>>>>> downloading the image I get a 400 bad request error
>>>>>
>>>>> def upload_img():
>>>>> record = db(db.t_upload).select().first()
>>>>> form = SQLFORM(
>>>>> db.t_upload,
>>>>> record,
>>>>> upload=URL('default', 'download')
>>>>> )
>>>>>
>>>>>
>>>>> I think it is some modification in web2py after publishing version 
>>>>> 2.21.1
>>>>>
>>>>> I have tried to attach a .w2p file with the myapp application but it 
>>>>> do

Re: [web2py] Re: LOAD in py4web

2022-02-15 Thread cdbaron
I have several projects with web2py and I have already started to study the 
possibility of migrating to py4web.

They are all rendered on the server side and for now I want to keep it that 
way.

I see some challenges that make me a little scared:

*LOAD
* A Helper: (many times with the callback parameter and others with _href)
* URL: With user_signature=True for links with callback

I use hundreds of times A and URL and a little less LOAD

For none of these functions or helpers have I found a direct replacement in 
py4web.

LOAD does not exist in py4web, A does not have the possibility of ajax 
calls with the callback parameter and URL is totally different in py4web.

It would be great to see some of this web2py magic carried over to py4web.

El domingo, 6 de febrero de 2022 a las 15:37:49 UTC+1, vinid...@gmail.com 
escribió:

> Have you managed to make a welcome template based on Unpoly?
>
> On Wednesday, March 4, 2020 at 8:37:51 PM UTC+7 yamand...@gmail.com wrote:
>
>> Sorry for the typo.
>> I want to make a welcome template based on unpoly soon.
>>
>> Em sex., 28 de fev. de 2020 às 04:21, AGRogers  
>> escreveu:
>>
>>> https://unpoly.com/  
>>>
>>> On Fri, 28 Feb 2020 at 16:22, Massimo Di Pierro  
>>> wrote:
>>>
 never heard of unpolly.js and cannot find it. Have a link?


 On Wednesday, 26 February 2020 19:32:20 UTC-8, Carlos Costa wrote:
>
> LOAD is a very cool thing! And beginners just say WOW when they can 
> create ajax-like experience so easy.
> But, IMO, it lacks some important features for modern apps, like error 
> handling and history handling.
>
> I have written some simple functions to help cover these things...
>
> Another way I found very useful was to use unpolly.js. It's magic but 
> makes me a little lazyer about getting things done with vue.js.
> (BTW they created unpolly to avoid using things like vue, react, etc, 
> really!)
>
> I would like very much to use vue.js but I am still noob regarding how 
> to use it with py4web.
> Maybe we should really encourage vue.js and stuff alike... but an 
> initial pattern would be cool.
> And IMO it should be simple and very cleared stated in the docs.
> So no one will miss LOAD.
>
> Em domingo, 23 de fevereiro de 2020 15:18:51 UTC-3, RHC escreveu:
>>
>> HI,
>>
>> I am beginning to experiment with py4web, I like the sound of it and 
>> I am looking to convert a web2py project to py4web to see how they 
>> compare.
>>
>> It appears that the LOAD (helper?) that was available in web2py 
>> templates is not available in py4web. I was using this to populate part 
>> of 
>> a web page, I liked the way you had the option to use LOAD to call a 
>> separate URL (within the same app) and insert the result into your page 
>> before returning the page to the client.
>>
>> What is the reason for the absence of LOAD in py4web? is there a 
>> recommended alternative method of achieving the same effect? I have used 
>> a 
>> mixture of ajax=True and ajax=False options for this feature.
>>
>> Thanks,
>>
>> Richard.
>>
> -- 
 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.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/22d8b9cf-9ce2-464b-809e-32d4dd84fd02%40googlegroups.com
  
 
 .

>>> -- 
>>> 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.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/web2py/CACWMBMPXoWfp9iZ7yQtbCw_YU6yh-9M2_xAQ%3Dzj4ocyWTzxuXw%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>>
>>
>> -- 
>> At.
>>
>> Carlos J. Costa
>> --
>> Cientista da Computação - Esp. Gestão em Telecom
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation

[web2py] Re: wev2py 2.22.1 is out

2022-02-14 Thread cdbaron
Hi Massimo,

Thanks for replying, this issue is driving me a little crazy...

* I noticed the change in behavior when updating from Version 2.19.1-stable 
to the github version of the end of December 2021 (before version 2.22.1)
* After this, I downloaded version 2.21.1 from web2py.com and it worked 
fine.
* Then with version 2.22.1 I continue with this problem.
* Yes, this behavior change was only detected when I declared a default 
application in routes.py in the root directory of web2py.
* Yes, if I upload a file the download link doesn't work, and the form 
itself can't display the image.
* The file is uploaded correctly and is in the correct directory.
* If I delete the routes.py file everything works fine and the file that I 
uploaded when I had declared the default application can be downloaded 
without problems, the link (with the name of the application in the url) 
works fine.
* one more thing, when I have the default application declared, if I upload 
an image with a.jpeg filename everything works fine, with any other aa.jpeg 
filename for example the download link gives me a 400 error.

I'm going to try to attach a zip file to a simple example application. A 
single table with a single field and a controller with a single function 
that creates a form.

https://www.dropbox.com/s/46bu3wjhjexathu/myapp.zip?dl=0


El domingo, 13 de febrero de 2022 a las 22:44:19 UTC+1, Massimo Di Pierro 
escribió:

> I am very confused by this. I cannot find any change that could cause this 
> change of behavior. Let me summarize to make sure I am understanding.
>
> You observed a change of behavior between 2.21.1 and 2.22 1.
> The change of behavior only manifests when you declare a default app in 
> routers.py
> The change of behavior consists of the fact that, if you upload a file 
> using a form, the link to download the file does not work.
> You can confirm that the file is there and the link works if no default 
> app in routers is provided.
>
> Is this all correct? If yes. I will debug more. If you could provide a 
> minimalist app to reproduce it would save me some time.
>
> Massimo
>
>
>
> On Wednesday, 9 February 2022 at 07:21:40 UTC-8 cdbaron wrote:
>
>> Now from github I can successfully download web2py.
>>
>> But I have a problem with a form with a field of type upload.
>>
>> With web2py 2.21.1 it works fine, but with version 2.22.1 it doesn't 
>> work. I have tested with python 3.7 and 3.8
>>
>> I already posted a query a few days ago, but I haven't had any response, 
>> I apologize for posting the same thing again.
>>
>> When I upload any image with a form, for example the one below, when 
>> downloading the image I get a 400 bad request error
>>
>> def upload_img():
>> record = db(db.t_upload).select().first()
>> form = SQLFORM(
>> db.t_upload,
>> record,
>> upload=URL('default', 'download')
>> )
>>
>>
>> I think it is some modification in web2py after publishing version 2.21.1
>>
>> I have tried to attach a .w2p file with the myapp application but it does 
>> not allow me to upload this type of file.
>>
>> The application works perfectly if I do NOT use a routes.py file in the 
>> web2py root directory.
>>
>> http://127.0.0.1:8000/myapp/upload/upload_img (Works fine)
>>
>> But with the file routers.py with this content:
>>
>> routers = dict(
>> BASE=dict(
>> default_application='myapp',
>> ),
>> )
>>
>> The application does not work well, there is a 400 error when downloading 
>> the
>> image uploaded with the form
>>
>> http://127.0.0.1:8000/upload/upload_img (Doesn't work right)
>>
>> This 400 error also occurs whenever the image is used, not just on the 
>> form.
>>
>> I am doing something wrong?
>
>

-- 
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/7a700b60-362e-4824-99d8-e2a948b5b414n%40googlegroups.com.


[web2py] Re: wev2py 2.22.1 is out

2022-02-09 Thread cdbaron
Now from github I can successfully download web2py.

But I have a problem with a form with a field of type upload.

With web2py 2.21.1 it works fine, but with version 2.22.1 it doesn't work. 
I have tested with python 3.7 and 3.8

I already posted a query a few days ago, but I haven't had any response, I 
apologize for posting the same thing again.

When I upload any image with a form, for example the one below, when 
downloading the image I get a 400 bad request error

def upload_img():
record = db(db.t_upload).select().first()
form = SQLFORM(
db.t_upload,
record,
upload=URL('default', 'download')
)


I think it is some modification in web2py after publishing version 2.21.1

I have tried to attach a .w2p file with the myapp application but it does 
not allow me to upload this type of file.

The application works perfectly if I do NOT use a routes.py file in the 
web2py root directory.

http://127.0.0.1:8000/myapp/upload/upload_img (Works fine)

But with the file routers.py with this content:

routers = dict(
BASE=dict(
default_application='myapp',
),
)

The application does not work well, there is a 400 error when downloading 
the
image uploaded with the form

http://127.0.0.1:8000/upload/upload_img (Doesn't work right)

This 400 error also occurs whenever the image is used, not just on the form.

I am doing something wrong?

-- 
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/37d04564-33d1-4302-a781-a191778c3e1dn%40googlegroups.com.


[web2py] Re: wev2py 2.22.1 is out

2022-02-01 Thread cdbaron
Hello, 

I have downloaded this latest version and the web2py/gluon/packages/dal 
directory is empty.

El martes, 1 de febrero de 2022 a las 4:59:33 UTC+1, Massimo Di Pierro 
escribió:

> Hello Everybody,
>
> web2py 2.22.1 is out.
>
> Includes a few bug fixes and some changes including:
> - support for mail.sent(reply_to=...), thanks Ofa
> - fix a bug to enable redis with python3, thanks Leonel
> - upgraded to latest pydal and yatl
>
> Please report any breakages or issues.
>
> Massimo
>

-- 
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/51fc7013-a0cb-4bbf-975a-d56cfce1632an%40googlegroups.com.


[web2py] Re: Edit crontab from the admin interface

2022-01-20 Thread cdbaron
Something like this should work...
http://127.0.0.1:8000/admin/edit/app/cron/crontab

El jueves, 20 de enero de 2022 a las 1:39:23 UTC+1, Lee P escribió:

> I need to edit my crontab file located in the /app/cron folder. The 
> problem is that I only have access to the admin interface of my deployment. 
> Is there an easy solution?

-- 
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/1b63e160-1536-4ca7-8254-3322f0c56b94n%40googlegroups.com.


[web2py] Fields of type 'upload' a bit broken in Master

2022-01-20 Thread cdbaron
Hello,

I recently updated an app:
Since web2py Version 2.19.1-stable+timestamp.2020.03.21.13.06.49 and Python 
3.6.8
A web2py latest version in Master at the end of 2021 (Version 
2.21.2-stable+timestamp.2021.10.15.07.44.23) and python 3.8

Everything seemed to work perfectly.

Now I have noticed that the forms with 'upload' fields are not working 
well. Actually the form seems to work fine and what doesn't work is the 
download of the image.

The problem only occurs when I have the following in the routes.py file:
routers = dict(
BASE=dict(
default_application='myapp',
),
)


In this situation, all requests for uploaded images return a 400 Bad 
Request error.

*With almost all jpg files I have problems, but for example if the image is 
called ff.jpg it works fine...*

I have traced the error to the file gluon.rewrite.py line above line1221:

def validate_args(self):
"""
Checks args against validation pattern
"""
for arg in self.args:
if not self.router._args_match.match(arg):
raiseHTTP(
400,
THREAD_LOCAL.routes.error_message % "invalid request",
web2py_error="invalid arg <%s>" % arg,
)


If I delete the routes.py file everything works fine. But I need myapp as 
the default app.

Example of the problem with a clean install downloaded from github:

models
db.define_table(
't_upload',
Field('f_upload_img', 'upload'),
)

Controller upload.py
def upload_img():
record = db(db.t_upload).select().first()
form = SQLFORM(
db.t_upload,
record,
upload=URL('default', 'download')
)

if form.process(keepvalues=True).accepted:
redirect(URL())

return dict(form=form)


*With myapp as default application*:
http://127.0.0.1:8081/upload_img
seems to work, but 
http://127.0.0.1:8000/download/t_upload.f_upload_img.bba19b6c318b6379.YmwxNTYxODI5Mzg3MTkzNi5qcGc=.jpg
*returns 400 bad request*


*Deleting router.py*
http://127.0.0.1:8000/pyapp/upload/upload_img
works fine and
http://127.0.0.1:8000/pyapp/default/download/t_upload.f_upload_img.ae2d38ca06c81a3d.YmwxNTYxODI5Mzg3MTkzNi5qcGc=.jpg
*returns the image*

Has anyone had this problem?

-- 
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/90bf9749-0a7f-413c-80c3-99a130073f09n%40googlegroups.com.


[web2py] Re: SQLFORM.grid - Readable True, but hide the column in table

2021-07-17 Thread cdbaron
 You should not use db.ftp_simplivity_log_db.log_path.readable = False
You have to use db.ftp_simplivity_log_db.log_path.listable = False

If you want to cancel the search for any field in the table you can use 
db.table.any_fielfd.searchable = Flase 

El viernes, 16 de julio de 2021 a las 17:56:43 UTC+2, jitun...@gmail.com 
escribió:

> With the following code, I can search log_path info
>
> db.ftp_simplivity_log_db.log_path.readable = True
> ftp_simplivity_log_grid = SQLFORM.grid(db.ftp_simplivity_log_db,
>searchable=True,
>advanced_search=False,
>   
>  orderby=~db.ftp_simplivity_log_db.log_date,
>sortable=True,
>details=False,
>csv=False,
>paginate=50,
>   
>  maxtextlengths={'ftp_simplivity_log_db.log_date': 100, 
> 'ftp_simplivity_log_db.log_path': 300},
>links=[lambda row: A('SimplifY 
> --> ' + row.log_path, _href=URL('download_simplivity_log', args=row.id), 
> _class='btn btn-light')])
>
>
> [image: with_log_path.jpg]
>
> But changing to False
> db.ftp_simplivity_log_db.log_path.readable = False
>
> [image: without_log_path.jpg]
>
> The output looks clean, but search is not able to search the log_path,
>
> [image: without_log_path_search.jpg]
>
> Hence the question I have is,
> Is there a way to keep
> db.ftp_simplivity_log_db.log_path.readable = True
> so search can work and still be able to hide it in the actual grid display 
> ?
>

-- 
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/377f0f76-ca2a-4ede-886e-b1ee1a3b41f2n%40googlegroups.com.


[web2py] Re: can i delete sql.log?

2021-02-10 Thread cdbaron
 Sql.log is an informative file, if you delete it, it will be created again. It 
does not affect the operation of the applications. In this file, SQL 
queries of the DB migrations are stored. 

El martes, 9 de febrero de 2021 a las 23:34:06 UTC+1, Ramos escribió:

> can i delete sql.log?
>

-- 
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/26ad2f8d-2467-4540-a5ab-61007cd6ea97n%40googlegroups.com.


[web2py] user signature is not working well. Not Authorized

2021-02-06 Thread cdbaron

Hi there,

When a signed url has a list of int values it is not working well and I get 
"Not Authorized"
Here is an example, link1 does not work, link2 works.

@auth.requires_login()
def index():
link1 = A(
'link1 Not Authorized :-(',
_href=URL(f='hello1', vars=dict(ids=[8, 28]), user_signature=True)
)
link2 = A(
'link2',
_href=URL(f='hello2', vars=dict(ids=[28]), user_signature=True)
)
return locals()

@auth.requires_signature()
def hello1():
return dict(hello='Hello 1')

@auth.requires_signature()
def hello2():
return dict(hello='Hello 2')


Has anyone had this problem? 
I am using the latest version of web2py (Version 
2.21.1-stable+timestamp.2020.11.27.18.21.43)

-- 
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/4a817a53-4071-47fd-b909-9a9084264984n%40googlegroups.com.


[web2py] Re: Using min(), max(), count() with groupby in SQLFORM.grid

2020-12-24 Thread cdbaron
It's a bit of an ugly trick, but I've ever done something like this before.

created_on_min = db.my_table.created_on.min().with_alias(created_on_min)
created_on_max = db.my_table.created_on.max().with_alias(created_on_max)
created_on_min.tablename = 'my_table' 
created_on_max.tablename = 'my_table'

fields = [
db.auth_user.id,
created_on_min,
created_on_max
]

Does anyone know of a better way to do it?

El miércoles, 23 de diciembre de 2020 a las 23:52:06 UTC+1, Vlad escribió:

> Is there a limitation in the way SQLFORM.grid() can be used with groupby 
> in the sense that functions like min(), max(), count() can't be used? 
>
> the following gives an error: 
> fields = [db.auth_user.id, db.my_table.created_on.min(), 
> db.my_table.created_on.max()]
> grid = SQLFORM.grid(query, fields=fields, groupby= db.auth_user.id)
>
> the error is: 
>  'Expression' object has no attribute 'tablename'
>   
>

-- 
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/171a8b1f-a9ed-4796-9481-59c5ea520e1fn%40googlegroups.com.


[web2py] SQLFORM.grid in ajax function with signed urls

2019-11-15 Thread cdbaron
Hello

I have a component that is loaded by ajax and this component has an 
SQLFORM.grid.
This component has a variable in the url.
For security reasons I want the ajax component to have the url signed.
The problem is that the grid pagination links generate a wrong signed url.

wrong signed url:

http:
//127.0.0.1:8001/pruebas/default/ajax_grid.load?fk=1&page=2&_signature=04fd4fd72bdbda072410fda2184d0ac3a94b4058

i get "ACCESS DENIED" because @auth.requires_signature()

grid generate wrong signed url in pagination when url have vars and 
requires signature.

Any way to solve the problem?

A simplified version of the code:

def prueba_grid():

# Same data
if not db(db.t_data).select():
for i in range(1, 100):
fk = i % 2
db.t_data.insert(f_data=i, f_fk=fk)

url = URL('default', 'ajax_grid.load', vars=dict(fk=1), user_signature=
True)
load_ajax_grid= LOAD(url=url, ajax=True)

return locals()

@auth.requires_signature()
def ajax_grid():
fk = request.get_vars.fk

grid = SQLFORM.grid(
db.t_data.f_fk == fk

)
return dict(grid=grid)

And de model:

db.define_table(
't_data',
Field('f_data', 'string', length=10),
Field('f_fk', 'integer'))..

view prueba_grid
{{extend 'layout.html'}}

{{=load_ajax_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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a59f050e-0dba-41ab-9676-b9ef55d9f1fb%40googlegroups.com.


[web2py] auth.signature on delete restrict

2019-11-05 Thread cdbaron
Hi,

I'm trying to use auth.signature with on delete restrict in the foreign 
keys `created_by` and` modified_by` but it doesn't seem to work.

I tried with auth.settings.ondelete = 'RESTRICT' but it doesn't work. 
auth.signature 
is defined when instantiating the Auth class.

How can I change the auth.settings?

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/57c3c52d-ee5e-48a1-9fd4-5fbc6cf5800e%40googlegroups.com.


[web2py] Re: SQLFORM.grid search with fields readable = False

2019-11-04 Thread cdbaron
It works,

but the solution is db.table.field.listable = False to hide fields in the 
gridand search, db.table.field.readable = False to hide fields and not 
search and db.table.field.searchable = False to show Fields in grid and not 
search.

El viernes, 1 de noviembre de 2019, 16:52:04 (UTC+1), Paul Ellis escribió:
>
> If you want the fields to be searchable. Then instead of setting readable 
> = false. 
>
> Hide the fields with:
>
> db.table.field.represent = lambda value, row: DIV(value, _class='hidden')
>
> and the column heading with:
>
> grid = SQLFORM.grid(
> headers = {
>  'table.field' : DIV(_style = "display:None"),
> }
> )
>
>
>

-- 
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/0a6b5dc0-767f-4ca5-9832-8c4cba55abc0%40googlegroups.com.


[web2py] Re: SQLFORM.grid search with fields readable = False

2019-10-30 Thread cdbaron

>
> This is my code
>

def federados():

# Tablas de la BBDD
t_licencias = db.t_licencias
t_licencias_agrupaciones = db.t_licencias_agrupaciones
t_federados = db.t_federados

# Campos del grid
fields = [
t_federados.id,
t_federados.f_foto,
t_federados.f_fecha_nacimiento,
t_federados.f_dni,
t_federados.f_pasaporte,
t_federados.f_nombre,
t_federados.f_apellido1,
t_federados.f_apellido2,
t_federados.f_nacionalidad,
t_federados.f_direccion,
t_federados.f_poblacion,
t_federados.f_provincia,
t_federados.f_pais,
t_federados.f_codigo_postal,
t_federados.f_telefono_fijo,
t_federados.f_telefono_movil,
t_federados.f_email,
]

# Campos ocultos
t_federados.f_foto.readable = False
t_federados.f_fecha_nacimiento.readable = False
t_federados.f_dni.readable = False
t_federados.f_pasaporte.readable = False
t_federados.f_nombre.readable = False
t_federados.f_apellido1.readable = False
t_federados.f_apellido2.readable = False
t_federados.f_nacionalidad.readable = False
t_federados.f_direccion.readable = False
t_federados.f_poblacion.readable = False
t_federados.f_provincia.readable = False
t_federados.f_pais.readable = False
t_federados.f_codigo_postal.readable = False
t_federados.f_telefono_fijo.readable = False
t_federados.f_telefono_movil.readable = False
t_federados.f_email.readable = False

def represent_federado(f, r):

represent = DIV(_class="row")

nacimiento = Fechas.nacimiento_edad(r.f_fecha_nacimiento)
nombre = f'{r.f_apellido1} {r.f_apellido2}, {r.f_nombre}'

# foto
represent.insert(0, IMG(_height='100', _width='75', 
_class='grid-foto m-1',
_src=URL(c='federados', f='download', 
args=r.f_foto)))

represent.append(CAT(
DIV(
DIV(nombre), DIV(r.f_dni), DIV(r.f_nacionalidad), 
DIV(nacimiento),
_class='grid-datos-federado m-1'),
))

represent.append(CAT(
DIV(
DIV(r.f_telefono_fijo), DIV(r.f_telefono_movil), 
DIV(r.f_email),
_class='grid-datos-federado m-1'),
))

return represent

   
id_entidad = auth.user.f_id_entidad

query = (t_licencias.f_id_entidad == id_entidad) & \
(t_licencias_agrupaciones.f_id_temporada == temporada_actual.id)

left = [
t_licencias_agrupaciones.on((t_licencias_agrupaciones.f_id_federado 
== t_federados.id)),
t_licencias.on(t_licencias.f_id_agrupacion == 
t_licencias_agrupaciones.id),
]

groupby = [t_licencias_agrupaciones.f_id_federado]
orderby = [t_federados.f_apellido1, t_federados.f_apellido2, 
t_federados.f_nombre]
   
t_federados.id.represent = lambda f, r: represent_federado(f, r)
t_federados.id.label = T('Datos de los federados')

grid = SQLFORM.grid(query,
fields=fields,
field_id=db.t_federados.id,
left=left,
groupby=groupby,
orderby=orderby,
paginate=10,
advanced_search=False,
deletable=False,
editable=False,
details=False,
create=False,
csv=False)

return dict(grid=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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/75b80fb4-c5b3-4eab-b88e-2bcf83252450%40googlegroups.com.


[web2py] SQLFORM.grid search with fields readable = False

2019-10-26 Thread cdbaron
Hello,

I have an SQLFROM.grid in which I render each of the lines with a special 
format using only the id field of the table (id.represent). Attached image 
with the result.

Everything works perfect except when searching records. The issue is that 
hidden fields (readable = False) are excluded from the search.

This is the code in sqlhtml.py that that blocks the search

 sfields = reduce (lambda a, b: a + b,
 [[f for f in t if f.readable and f.searchable] 
for t in tables])

Why fields are excluded with readable = False if searchable = False exists?

Any way to search across all fields of the sql query?


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/aaee99b9-f8bc-44b8-a9f2-7a2886d22a85%40googlegroups.com.