Re: [web2py] Re: Looking for web2py developer for Italian small company

2020-02-12 Thread Dave S


On Wednesday, February 12, 2020 at 12:02:10 PM UTC-8, Vlad wrote:
>
> I've used web2py happily until today, but seems need to switch to py4web :)
>
> I've never looked into py4web; just saw msgs going back and forth about 
> it. 
>
> What's the best way to start? Any tutorials? Is there a book similar to 
> the one on web2py? What's the home page (assuming it's separate from web2py 
> itself)? 
>

>From those other messages:
http://py4web.com/_documentation/static/index.html>

/dps

 

> On Monday, February 10, 2020 at 11:13:56 AM UTC-5, Massimo Di Pierro wrote:
>>
>> Hello Victor,
>>
>> I recommend everybody to move from web2py to py4web. I am using the 
>> latter for my own projects and find it better.
>> Honestly web2py has more features and it has been battle-tested but 
>> py4web is catching up quickly and, if you do not need the grid, I think it 
>> is already better.
>>
>> Massimo
>>
>>
>>
>> On Sunday, 9 February 2020 21:58:26 UTC-8, VJ Sosa wrote:
>>>
>>> Dear Massimo,
>>>
>>> One month ago I just started to develop some demos of a web application 
>>> using web2py. I'm interested in go further with a more serious 
>>> implementation,
>>> but today I'm realizing that this group is also talking about py4web.
>>> Considering that py4web is your new bet for a python framework, do you 
>>> recommend me to go further with py4web instead of web2py?
>>> Will be web2py deprecated in a close future?
>>> Are you planning offer similar documentation (like a book) for py4web?
>>>
>>> Thanks in advance, I do appreciate your work.
>>> Víctor.
>>>
>>> El jueves, 30 de enero de 2020, 7:10:45 (UTC+1), Massimo Di Pierro 
>>> escribió:

 Yes. for me it is the future. It is usable. I recently tried to port 
 some of my apps from web2py to py4wb and f they do not use grid, the 
 transition is almost trivial. The code ends up cleaner and you can use 
 pylint and other tools to find errors. Converting complex Auth logic can 
 be 
 tricky. 

 On Wednesday, 22 January 2020 08:12:04 UTC-8, Hugo Alberto Rivera Diaz 
 wrote:
>
> Massimo,an honor to salute you! One question so you would recommend 
> the use of py4web over web2py? Is py4web te next step for web2py 
> developers?
>
> El mié., 22 ene. 2020 a las 0:23, Massimo Di Pierro (<
> massimo...@gmail.com>) escribió:
>
>> I strongly recommend py4web + vue.js :-)
>>
>> On Tuesday, 21 January 2020 07:40:18 UTC-8, Ivan Gazzola wrote:
>>
>>> We are a small company in Italy, we need a new developer for our 
>>> project (xortho.it)
>>>
>>> The web app is developed with jquery mobile and web2py, we are 
>>> planning to move to angular and web2py or better py4web.
>>>  
>>> If you're interested please contact us.
>>>
>>> Ciao
>>>
>>> Ivan
>>>
>>> -- 
>> 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 web...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/fc6ea910-acbb-45b7-9553-2e33152d2863%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
>   * Saludos!*
>*Hugo Alberto Rivera Diaz* 
>
>


-- 
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/48f63a69-dace-443d-b726-edea6164af31%40googlegroups.com.


Re: [web2py] Re: Looking for web2py developer for Italian small company

2020-02-12 Thread Vlad
I've used web2py happily until today, but seems need to switch to py4web :)

I've never looked into py4web; just saw msgs going back and forth about it. 

What's the best way to start? Any tutorials? Is there a book similar to the 
one on web2py? What's the home page (assuming it's separate from web2py 
itself)? 


On Monday, February 10, 2020 at 11:13:56 AM UTC-5, Massimo Di Pierro wrote:
>
> Hello Victor,
>
> I recommend everybody to move from web2py to py4web. I am using the latter 
> for my own projects and find it better.
> Honestly web2py has more features and it has been battle-tested but py4web 
> is catching up quickly and, if you do not need the grid, I think it is 
> already better.
>
> Massimo
>
>
>
> On Sunday, 9 February 2020 21:58:26 UTC-8, VJ Sosa wrote:
>>
>> Dear Massimo,
>>
>> One month ago I just started to develop some demos of a web application 
>> using web2py. I'm interested in go further with a more serious 
>> implementation,
>> but today I'm realizing that this group is also talking about py4web.
>> Considering that py4web is your new bet for a python framework, do you 
>> recommend me to go further with py4web instead of web2py?
>> Will be web2py deprecated in a close future?
>> Are you planning offer similar documentation (like a book) for py4web?
>>
>> Thanks in advance, I do appreciate your work.
>> Víctor.
>>
>> El jueves, 30 de enero de 2020, 7:10:45 (UTC+1), Massimo Di Pierro 
>> escribió:
>>>
>>> Yes. for me it is the future. It is usable. I recently tried to port 
>>> some of my apps from web2py to py4wb and f they do not use grid, the 
>>> transition is almost trivial. The code ends up cleaner and you can use 
>>> pylint and other tools to find errors. Converting complex Auth logic can be 
>>> tricky. 
>>>
>>> On Wednesday, 22 January 2020 08:12:04 UTC-8, Hugo Alberto Rivera Diaz 
>>> wrote:

 Massimo,an honor to salute you! One question so you would recommend the 
 use of py4web over web2py? Is py4web te next step for web2py developers?

 El mié., 22 ene. 2020 a las 0:23, Massimo Di Pierro (<
 massimo...@gmail.com>) escribió:

> I strongly recommend py4web + vue.js :-)
>
> On Tuesday, 21 January 2020 07:40:18 UTC-8, Ivan Gazzola wrote:
>
>> We are a small company in Italy, we need a new developer for our 
>> project (xortho.it)
>>
>> The web app is developed with jquery mobile and web2py, we are 
>> planning to move to angular and web2py or better py4web.
>>  
>> If you're interested please contact us.
>>
>> Ciao
>>
>> Ivan
>>
>> -- 
> 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 web...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/fc6ea910-acbb-45b7-9553-2e33152d2863%40googlegroups.com
>  
> 
> .
>


 -- 
   * Saludos!*
*Hugo Alberto Rivera Diaz* 


>>>

-- 
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/46d74f88-d9ad-475a-b264-7f682fefdbe3%40googlegroups.com.


Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Clemens
Hi Chris,

thanks a lot for your help! But the problem still exists even replacing my 
str_replace routine by str.replace() as proposed by you. Yes, I had the 
same problem with line breaks crashing the view. And replacing the line 
breaks by  fixed it. But switching form python 2.7 to 3.6 raises the 
new problem that the sanitizer can't process -coded line breaks. 
Without sanitize=True (i.e. False by default) it also works with python 
3.6. But sanitize=True doesn't work for -coded line breaks under 
python 3.6. And this is the case only for line breaks, all other special 
character are no problem.

I really think, that the XML sanitizer under python 3.6 is the problem. Do 
you have an idea for a work around except of eliminating all line breaks, 
cause I can't do this?

Best regards
Clemens


On Wednesday, February 12, 2020 at 4:42:53 PM UTC+1, Christian Varas wrote:
>
> Hi Clemens, 
>
> Replace can handle big text it does not matter if is 1 - 1000 lines or 
> more, It will replace all the occurrences in the text, also is faster. 
> chaining "replace" is more faster than other methods.
>
> description = his_item.description.replace("\n","").replace("\r","
> ").replace("<","").replace(">","")
> XML(description, sanitize=True)
>
> or in one line
>
> XML(his_item.description.replace("\n","").replace("\r","")
> .replace("<","").replace(">",""), sanitize=True)
>
>
> A(this_item.title, \
>   callback = URL('item', 'select', \
>  vars=dict(uuid=this_item.uuid), user_signature=True), \
>   _title=XML(his_item.description.replace("\n","").replace("\r","
> ").replace("<","").replace(">",""), sanitize=True)
>
> I had this issue with line breaks and XML helper also, the input 
> containing line breaks was breaking my view, and replacing the bad 
> characters before pass it to the helper fixed my problem.
>
> Try in a console with a custom text and see the results.
>
> Hope this helps
> Cheers.
> Chris.
>
> El mié., 12 feb. 2020 a las 10:08, Clemens ( >) escribió:
>
>> Hello Chris,
>>
>> thanks for your answer! But just kicking out all line breaks is a little 
>> harsh, since in my case the description is mostly a few lines long with 2 
>> or 3 paragraphs. And I had the problem already solved by this procedure and 
>> the call as described in my question:
>>
>> def str_replace(string, replacement_dict):
>>> if not isinstance(string, str):
>>> string = str(string)
>>> pattern = re.compile('|'.join([re.escape(k) for k in 
>>> list(replacement_dict.keys())]), re.M)
>>> return pattern.sub(lambda x: replacement_dict[x.group(0)], string)
>>>
>>
>> And this solution worked very well with python 2.7, having even line 
>> breaks in link titles. Then I moved to python 3.6 and the problem was 
>> there. Thus, I think, that the XML sanitizer under Python 3.6 is the 
>> problem, since it can't handle 
>>
>> Do you have any other ideas?
>>
>> Best regards
>> Clemens
>>
>>
>> On Wednesday, February 12, 2020 at 12:08:17 PM UTC+1, Christian Varas 
>> wrote:
>>>
>>> I had an issue with line breaks too, I remove lie breaks like this with 
>>> python 3.7
>>>
>>> some_string = some_string.replace(“\n”, ””).replace(“\r”, ””)
>>>
>>> XML(some_string, sanitize=True)
>>>
>>> Cheers
>>> Chris
>>>
>>> El El mié, 12 de feb. de 2020 a la(s) 04:37, Clemens <
>>> clemens...@claret-clover.de> escribió:
>>>
 Hello!

 In my web2py app I’m processing a list of items, where the user can 
 click on a link for each item to select this. An item has an UUID, a title 
 and a description. For a better orientation the item description is also 
 displayed as link title. To prevent injections by and to escape tags in 
 the 
 description I’m using the XML sanitizer as follows:

 A(this_item.title, \
   callback = URL('item', 'select', \
  vars=dict(uuid=this_item.uuid), user_signature=True), \
   _title=XML(str_replace(this_item.description, {'\r\n':'', 
 '<':'', '>':''}), sanitize=True))

 Using Python 2.7 everything was fine. Since I have switched to Python 
 3.6 I have the following problem. When the description contains line 
 breaks 
 the sanitizer is not working anymore. For example the following string 
 produces by my str_replace routine is fine to be sanitized by the XML 
 helper under Python 2.7 but not under Python 3.6:

 HeaderLine1Line2Line3
>

 Sanitizing line breaks escaped by  is the problem with Python 3 
 (but not with Python 2). Everything else is no problem for the XML helper 
 to sanitize (e.g. less than or greater than, I need these, since if there 
 is no description it is generated as ).

 How can be line breaks sanitized by the XML helper running web2py under 
 Python3?

 Thanks for any support!

 Best regards Clemens
 

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

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Christian Varas
Hi Clemens,

Replace can handle big text it does not matter if is 1 - 1000 lines or
more, It will replace all the occurrences in the text, also is faster.
chaining "replace" is more faster than other methods.

description = his_item.description.replace("\n","").replace("\r","
").replace("<","").replace(">","")
XML(description, sanitize=True)

or in one line

XML(his_item.description.replace("\n","").replace("\r","")
.replace("<","").replace(">",""), sanitize=True)


A(this_item.title, \
  callback = URL('item', 'select', \
 vars=dict(uuid=this_item.uuid), user_signature=True), \
  _title=XML(his_item.description.replace("\n","").replace("\r","
").replace("<","").replace(">",""), sanitize=True)

I had this issue with line breaks and XML helper also, the input containing
line breaks was breaking my view, and replacing the bad characters before
pass it to the helper fixed my problem.

Try in a console with a custom text and see the results.

Hope this helps
Cheers.
Chris.

El mié., 12 feb. 2020 a las 10:08, Clemens (<
clemens.odend...@claret-clover.de>) escribió:

> Hello Chris,
>
> thanks for your answer! But just kicking out all line breaks is a little
> harsh, since in my case the description is mostly a few lines long with 2
> or 3 paragraphs. And I had the problem already solved by this procedure and
> the call as described in my question:
>
> def str_replace(string, replacement_dict):
>> if not isinstance(string, str):
>> string = str(string)
>> pattern = re.compile('|'.join([re.escape(k) for k in
>> list(replacement_dict.keys())]), re.M)
>> return pattern.sub(lambda x: replacement_dict[x.group(0)], string)
>>
>
> And this solution worked very well with python 2.7, having even line
> breaks in link titles. Then I moved to python 3.6 and the problem was
> there. Thus, I think, that the XML sanitizer under Python 3.6 is the
> problem, since it can't handle 
>
> Do you have any other ideas?
>
> Best regards
> Clemens
>
>
> On Wednesday, February 12, 2020 at 12:08:17 PM UTC+1, Christian Varas
> wrote:
>>
>> I had an issue with line breaks too, I remove lie breaks like this with
>> python 3.7
>>
>> some_string = some_string.replace(“\n”, ””).replace(“\r”, ””)
>>
>> XML(some_string, sanitize=True)
>>
>> Cheers
>> Chris
>>
>> El El mié, 12 de feb. de 2020 a la(s) 04:37, Clemens <
>> clemens...@claret-clover.de> escribió:
>>
>>> Hello!
>>>
>>> In my web2py app I’m processing a list of items, where the user can
>>> click on a link for each item to select this. An item has an UUID, a title
>>> and a description. For a better orientation the item description is also
>>> displayed as link title. To prevent injections by and to escape tags in the
>>> description I’m using the XML sanitizer as follows:
>>>
>>> A(this_item.title, \
>>>   callback = URL('item', 'select', \
>>>  vars=dict(uuid=this_item.uuid), user_signature=True), \
>>>   _title=XML(str_replace(this_item.description, {'\r\n':'',
>>> '<':'', '>':''}), sanitize=True))
>>>
>>> Using Python 2.7 everything was fine. Since I have switched to Python
>>> 3.6 I have the following problem. When the description contains line breaks
>>> the sanitizer is not working anymore. For example the following string
>>> produces by my str_replace routine is fine to be sanitized by the XML
>>> helper under Python 2.7 but not under Python 3.6:
>>>
>>> HeaderLine1Line2Line3

>>>
>>> Sanitizing line breaks escaped by  is the problem with Python 3
>>> (but not with Python 2). Everything else is no problem for the XML helper
>>> to sanitize (e.g. less than or greater than, I need these, since if there
>>> is no description it is generated as ).
>>>
>>> How can be line breaks sanitized by the XML helper running web2py under
>>> Python3?
>>>
>>> Thanks for any support!
>>>
>>> Best regards Clemens
>>> 
>>>
>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/319d22e0-d1be-452c-8c25-d1ec76df1a5e%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] Re: special chars in view, utf8 issue ?!

2020-02-12 Thread Clemens
Hello Ramos,

since I can't see your screenshot, I have to guess. But in German we also 
our special characters and I encode these by the following procedure:

import re
> import sys
>
> def convert_special_chars(label):
> if sys.version_info[0]==2: # python 2.x
> label = label.decode('utf-8')
> label = cgi.escape(label)
> label = label.encode('ascii', 'xmlcharrefreplace')
>
> return label
>

Have a try! Hope it helps!

Best regards
Clemens


On Wednesday, February 12, 2020 at 12:12:41 PM UTC+1, Ramos wrote:
>
> Hello i cant understand how to solve this issue.
> I have a record with portuguese characters 
> "Ações de cada um" that passing it to  the view results in a different 
> value.
> How do i understand it to solve it ?
>
> [image: image.png]
> This is the result in my view 
> My layout has  
> and my view is just 
>
> {{=a}}
>
> [image: image.png]
> and this is my controller
> # -*- coding: utf-8 -*-
> def execdal():
>
> ret=[]
> a=db(db.apps.id==1).select(db.apps.icon,db.apps.url,db.apps.bg
> ,db.apps.title,orderby=db.apps.id).as_list()
> return dict(a=a)
>

-- 
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/b63a8e8e-717a-41e7-b2fd-476dae50ebed%40googlegroups.com.


Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Clemens
Hello Chris,

thanks for your answer! But just kicking out all line breaks is a little 
harsh, since in my case the description is mostly a few lines long with 2 
or 3 paragraphs. And I had the problem already solved by this procedure and 
the call as described in my question:

def str_replace(string, replacement_dict):
> if not isinstance(string, str):
> string = str(string)
> pattern = re.compile('|'.join([re.escape(k) for k in 
> list(replacement_dict.keys())]), re.M)
> return pattern.sub(lambda x: replacement_dict[x.group(0)], string)
>

And this solution worked very well with python 2.7, having even line breaks 
in link titles. Then I moved to python 3.6 and the problem was there. Thus, 
I think, that the XML sanitizer under Python 3.6 is the problem, since it 
can't handle 

Do you have any other ideas?

Best regards
Clemens


On Wednesday, February 12, 2020 at 12:08:17 PM UTC+1, Christian Varas wrote:
>
> I had an issue with line breaks too, I remove lie breaks like this with 
> python 3.7
>
> some_string = some_string.replace(“\n”, ””).replace(“\r”, ””)
>
> XML(some_string, sanitize=True)
>
> Cheers
> Chris
>
> El El mié, 12 de feb. de 2020 a la(s) 04:37, Clemens <
> clemens...@claret-clover.de > escribió:
>
>> Hello!
>>
>> In my web2py app I’m processing a list of items, where the user can click 
>> on a link for each item to select this. An item has an UUID, a title and a 
>> description. For a better orientation the item description is also 
>> displayed as link title. To prevent injections by and to escape tags in the 
>> description I’m using the XML sanitizer as follows:
>>
>> A(this_item.title, \
>>   callback = URL('item', 'select', \
>>  vars=dict(uuid=this_item.uuid), user_signature=True), \
>>   _title=XML(str_replace(this_item.description, {'\r\n':'', 
>> '<':'', '>':''}), sanitize=True))
>>
>> Using Python 2.7 everything was fine. Since I have switched to Python 3.6 
>> I have the following problem. When the description contains line breaks the 
>> sanitizer is not working anymore. For example the following string produces 
>> by my str_replace routine is fine to be sanitized by the XML helper under 
>> Python 2.7 but not under Python 3.6:
>>
>> HeaderLine1Line2Line3
>>>
>>
>> Sanitizing line breaks escaped by  is the problem with Python 3 (but 
>> not with Python 2). Everything else is no problem for the XML helper to 
>> sanitize (e.g. less than or greater than, I need these, since if there is 
>> no description it is generated as ).
>>
>> How can be line breaks sanitized by the XML helper running web2py under 
>> Python3?
>>
>> Thanks for any support!
>>
>> Best regards Clemens
>> 
>>
>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/319d22e0-d1be-452c-8c25-d1ec76df1a5e%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/64244a11-0964-4e44-9b75-e9d9e8d33f83%40googlegroups.com.


[web2py] Re: cannot reference db.auth_group in model ?

2020-02-12 Thread António Ramos
problem solved.
Forgot to add "*list:*reference auth_group"

regards
António

Em qua., 12 de fev. de 2020 às 11:31, António Ramos 
escreveu:

> any help ?
> thank you
>
> Em qua., 12 de fev. de 2020 às 11:31, António Ramos 
> escreveu:
>
>> correct model
>> db.define_table("apps",
>> Field("title"),
>> Field("icon"),
>> Field("bg"),
>> Field("url"),
>> format='%(title)s'
>> )
>> db.define_table('menus',
>> Field("visibleTo",'reference auth_group'),
>> Field("app",'reference apps'),
>> Field('content','list:string'),
>> Field('icon'),
>> Field('href'),
>> Field('indice')
>> )
>> db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',
>> multiple=True)
>>
>> Em qua., 12 de fev. de 2020 às 11:30, António Ramos 
>> escreveu:
>>
>>> Hello all i have a problem relating a record to auth_group records
>>>
>>> creating in admin a new record in table menus, referencing one or more
>>> auth_group record results in a record with None in visibleTo field.
>>> Why ?
>>> [image: image.png]
>>> db.define_table("apps",
>>> Field("title"),
>>> Field("icon"),
>>> Field("bg"),
>>> Field("url"),
>>> format='%(title)s'
>>> )
>>> db.define_table('menus',
>>> Field("visibleTo",'reference auth_group'),
>>> Field("app",'reference apps'),
>>> Field('content','list:string'),
>>> Field('icon'),
>>> Field('href'),
>>> Field('indice')
>>> )
>>> db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',
>>> multiple=True)
>>> Field('href'),
>>> Field('indice')
>>> )
>>>
>>

-- 
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/CAEM0BxNkiap2CHw7SCR-HH_YqShWYYsYuAfN2nSvmVYaXcHQPQ%40mail.gmail.com.


[web2py] py4web Form customization

2020-02-12 Thread Alex Beskopilny
is that possible? 

similar to the web2py

{{=form.custom.begin}}Name: 
{{=form.custom.widget.name}}{{=form.custom.submit}}{{=form.custom.end}}

 form.element('input[name=name]')['_id']='myid'
 form.element('input[name=name]')['_class']='myclass'


Thanks
Alex

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/12c5163a-651d-4761-900a-70e9edc80fb7%40googlegroups.com.


[web2py] Re: cannot reference db.auth_group in model ?

2020-02-12 Thread António Ramos
correct model
db.define_table("apps",
Field("title"),
Field("icon"),
Field("bg"),
Field("url"),
format='%(title)s'
)
db.define_table('menus',
Field("visibleTo",'reference auth_group'),
Field("app",'reference apps'),
Field('content','list:string'),
Field('icon'),
Field('href'),
Field('indice')
)
db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',multiple
=True)

Em qua., 12 de fev. de 2020 às 11:30, António Ramos 
escreveu:

> Hello all i have a problem relating a record to auth_group records
>
> creating in admin a new record in table menus, referencing one or more
> auth_group record results in a record with None in visibleTo field.
> Why ?
> [image: image.png]
> db.define_table("apps",
> Field("title"),
> Field("icon"),
> Field("bg"),
> Field("url"),
> format='%(title)s'
> )
> db.define_table('menus',
> Field("visibleTo",'reference auth_group'),
> Field("app",'reference apps'),
> Field('content','list:string'),
> Field('icon'),
> Field('href'),
> Field('indice')
> )
> db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',
> multiple=True)
> Field('href'),
> Field('indice')
> )
>

-- 
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/CAEM0BxNcNKk%3DxXXeFeGx9Q8Gu5brxSLSpAGhAoZF0D4_MbjZhw%40mail.gmail.com.


[web2py] Re: cannot reference db.auth_group in model ?

2020-02-12 Thread António Ramos
any help ?
thank you

Em qua., 12 de fev. de 2020 às 11:31, António Ramos 
escreveu:

> correct model
> db.define_table("apps",
> Field("title"),
> Field("icon"),
> Field("bg"),
> Field("url"),
> format='%(title)s'
> )
> db.define_table('menus',
> Field("visibleTo",'reference auth_group'),
> Field("app",'reference apps'),
> Field('content','list:string'),
> Field('icon'),
> Field('href'),
> Field('indice')
> )
> db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',
> multiple=True)
>
> Em qua., 12 de fev. de 2020 às 11:30, António Ramos 
> escreveu:
>
>> Hello all i have a problem relating a record to auth_group records
>>
>> creating in admin a new record in table menus, referencing one or more
>> auth_group record results in a record with None in visibleTo field.
>> Why ?
>> [image: image.png]
>> db.define_table("apps",
>> Field("title"),
>> Field("icon"),
>> Field("bg"),
>> Field("url"),
>> format='%(title)s'
>> )
>> db.define_table('menus',
>> Field("visibleTo",'reference auth_group'),
>> Field("app",'reference apps'),
>> Field('content','list:string'),
>> Field('icon'),
>> Field('href'),
>> Field('indice')
>> )
>> db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',
>> multiple=True)
>> Field('href'),
>> Field('indice')
>> )
>>
>

-- 
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/CAEM0BxOaybifw7EaueSrH%3DJg-UHj0HSp1O39K64RHbdoCM6QnQ%40mail.gmail.com.


[web2py] cannot reference db.auth_group in model ?

2020-02-12 Thread António Ramos
Hello all i have a problem relating a record to auth_group records

creating in admin a new record in table menus, referencing one or more
auth_group record results in a record with None in visibleTo field.
Why ?
[image: image.png]
db.define_table("apps",
Field("title"),
Field("icon"),
Field("bg"),
Field("url"),
format='%(title)s'
)
db.define_table('menus',
Field("visibleTo",'reference auth_group'),
Field("app",'reference apps'),
Field('content','list:string'),
Field('icon'),
Field('href'),
Field('indice')
)
db.menus.visibleTo.requires=IS_IN_DB(db,db.auth_group.id,'%(role)s',multiple
=True)
Field('href'),
Field('indice')
)

-- 
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/CAEM0BxN4xwpbHKgTy1xpCm%2B4dHfyO13%3Da9PUyruQUV5ao_U0Vw%40mail.gmail.com.


[web2py] special chars in view, utf8 issue ?!

2020-02-12 Thread António Ramos
Hello i cant understand how to solve this issue.
I have a record with portuguese characters
"Ações de cada um" that passing it to  the view results in a different
value.
How do i understand it to solve it ?

[image: image.png]
This is the result in my view
My layout has  
and my view is just

{{=a}}

[image: image.png]
and this is my controller
# -*- coding: utf-8 -*-
def execdal():

ret=[]
a=db(db.apps.id==1).select(db.apps.icon,db.apps.url,db.apps.bg
,db.apps.title,orderby=db.apps.id).as_list()
return dict(a=a)

-- 
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/CAEM0BxOD2GcK4y9U528BrCK%3DgFNZrqdXz%2BuRWxzRGF5-aQ%3DkZQ%40mail.gmail.com.


Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Christian Varas
I had an issue with line breaks too, I remove lie breaks like this with
python 3.7

some_string = some_string.replace(“\n”, ””).replace(“\r”, ””)

XML(some_string, sanitize=True)

Cheers
Chris

El El mié, 12 de feb. de 2020 a la(s) 04:37, Clemens <
clemens.odend...@claret-clover.de> escribió:

> Hello!
>
> In my web2py app I’m processing a list of items, where the user can click
> on a link for each item to select this. An item has an UUID, a title and a
> description. For a better orientation the item description is also
> displayed as link title. To prevent injections by and to escape tags in the
> description I’m using the XML sanitizer as follows:
>
> A(this_item.title, \
>   callback = URL('item', 'select', \
>  vars=dict(uuid=this_item.uuid), user_signature=True), \
>   _title=XML(str_replace(this_item.description, {'\r\n':'',
> '<':'', '>':''}), sanitize=True))
>
> Using Python 2.7 everything was fine. Since I have switched to Python 3.6
> I have the following problem. When the description contains line breaks the
> sanitizer is not working anymore. For example the following string produces
> by my str_replace routine is fine to be sanitized by the XML helper under
> Python 2.7 but not under Python 3.6:
>
> HeaderLine1Line2Line3
>>
>
> Sanitizing line breaks escaped by  is the problem with Python 3 (but
> not with Python 2). Everything else is no problem for the XML helper to
> sanitize (e.g. less than or greater than, I need these, since if there is
> no description it is generated as ).
>
> How can be line breaks sanitized by the XML helper running web2py under
> Python3?
>
> Thanks for any support!
>
> Best regards Clemens
> 
>
> --
> 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/319d22e0-d1be-452c-8c25-d1ec76df1a5e%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CA%2Bs%2BuJuw-nsFkRiXaeiC6JmJ%2B-gFwN3E5MTSzZLTp%2ByL0btQ3g%40mail.gmail.com.