Re: [web2py] Re: Web2py with python 3.8.5

2021-01-03 Thread Serge Bourgeois
Hello,
I'm trying to convert my web2py apps to Ubuntu 20.4 / apache2/wsgi using 
python 3.8.5, and as I'm not an IT expert, the only way I found was to 
change the import instructions in a series of modules. I am aware I 
shouldn't do this, but I couldn't find any alternative... 
I would apreciate getting any feedback with another solution, and/or 
corrections of my 'durty coding'.

Action 1:
- usr/lib/python3/dist-packages/yaml___init.py - line 399: 
 replace def class YAMLObject(metaclass=YAMLObjectMetaclass):
by
def class YAMLObject:
__metaclass__=YAMLObjectMetaclass
Action 2:
create /etc/securetty file (there was an example of content of this file in 
/usr/share/doc/util-linux/examples/securetty)

Action 3:
add following line in 
/homr/www-data/web2py/gulon/packages/dal/pydal/adapters/base.py, line 16:
if not '/usr/lib/python3/dist-packages' in sys.path:
sys.path.append(''/usr/lib/python3/dist-packages')

Action 4:
This 'import' instrunction of python is incompatible with the previous 
version. In each module (for instance gluon), the import of 'brother 
modules' (modules in the same folder than gluon) are done with the 
following type of instruction: 'from gluon import xxx'
This doesn't work in my configuration, because import instructions starting 
with a 'from' are supposed to refer to the relative path of the module, and 
not the absolute path (which scans sys.path).
=> this instrunction must be changed (for instance by 'from .gluon import 
xxx')

I am still working to get my system running, but at least, I can start 
web2py...

I do not want to enter into phylosophical discussion about what I am 
authorized to do or not, and I hope that in early 2021, the evolution of 
ubuntu, python, web2py and other usefull packages will take care to keep 
harmony in the strategy of their evolution.


Le vendredi 29 novembre 2019 à 21:20:38 UTC+1, kell...@gmail.com a écrit :

> Maybe, it wasn't on the radar of the django developers either and had to 
> be fixed in the framework after python3 was released.
>
> Happens sometimes I suppose, hard to keep up with depreciation of 
> functions and the impact on a framework. 
>
> Anyways, I suppose we juar have to file the bug reports and fix each 
> function step by step until all deprecated functions are removed and 
> replaced with the ones that need to be used for python 3.8 and forward.
>
>
>
>
>
> On Fri, 29 Nov 2019, 20:44 Woody,  wrote:
>
>> Shouldn't that be done before the release rather than afterward?
>>
>> -- 
>> 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/cbb87866-f170-4338-ba3f-e93dfc3861f3%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/ba7511c0-ef8e-480e-ab2b-4ad90e64b395n%40googlegroups.com.


Re: [web2py] How to sort a smartgrid with your own custom sorted id list

2020-06-24 Thread Serge Bourgeois
Have you tried the orderby option of the smartgrid?
Example of conctent:
orderby = dict(t_prj_doc_item= [ db.t_prj_doc_item.f_sequence, 
db.t_prj_doc_item.id]),

Le mardi 23 juin 2020 à 00:48:54 UTC+2, roge...@gmail.com a écrit :

> The only thing that comes to mind is to put your sort data into the 
> database so you have something to sort on. If it is a single user app then 
> it's easy - add a new column called sortid and put your custom sort order 
> their.
>
> Multi user needs a second table to join on which might mess with smart 
> grid. 
>
> If you are not trying to display a lot of data you could make a copy of 
> the table in memory using your order and give that to smart grid.
>
> You can also modify (for that one call) the actual table. I am not sure 
> how that works for adding fields though. Perhaps you could add a field and 
> put your data in. It might magically disappear after the function closes. 
> Or you could drop the field manually if it didn't. 
>
> On Fri, 19 Jun 2020, 1:38 am rāma,  wrote:
>
>> Hi all,
>>
>> How to sort a smartgrid with your own custom sorted id list?
>>
>> Say I have a id list of the query and I have a sorting functions that 
>> returns a sorted id list, how would I make smartgrid to commit to the 
>> ordering instead of sorting by ids by default?
>>
>> Thanks,
>> rama
>>
>> -- 
>> 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/a078772b-0d41-4993-8df7-b9e5c223e9d0o%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/104d7478-8a5e-4b1b-bc8c-3f035895c343n%40googlegroups.com.


[web2py] modules: NameError("name 'reload' is not defined",)

2020-06-24 Thread Serge Bourgeois

I have an issue saving my modues with the last version of web2py.
Is there something I do wrong?

Context: Ubuntu 18.04 / web2py version 2.20.4 / python 3.6.9

How to reproduce this issue (a bug??) with a simple example:

In the applications examples, create a module (for instance empty.py)

Then open it, 
=> url: 
127.0.0.1:8000/admin/default/edit/examples/modules/empty.py?id=modules__empty__py
The file contains 3 lines:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gluon import *

do not change anything and save it (ctrl + S)...

=> Since the last version, I get the following message:

 Impossible de recharger le module car:
 NameError("name 'reload' is not defined",)

Thanks for any advise...

-- 
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/f70af411-2d58-4a98-b864-97160094cce1o%40googlegroups.com.


[web2py] Re: Here's how to run Web2Py on IBM BlueMix

2018-07-06 Thread Serge Bourgeois
Hi Antony,
At first, thanks for your feed back. I just tried your suggestion . 
command line here under:

python2.7 ./app/web2py.py -a "a password**'' -i 0.0.0.0 -p $PORT -v 

The results of the push and of my connection to the welcome app are joined 
in the attached zip file.
Yesterday I made following tests, (without success):
- in web2:py/applications/welcome/models/db.py : uncomment 
'request.requires_https()'
- I tried launching web2py.py with --interfaces (with nothiing behind, 
which could be wrong?)

As you can see, web2py starts and is expecting to get a request from 
http://127.0.0.1:8080.
I would like to know if there is a function in the framework which 
generates this URL, so that I could have a look at it and understand how I 
could get something like 'https://tripkit.eu-gb.mybluemix.net' 

In the IBM bluemix doc, up to now, nothing yet about web2py.
There is an example with Fask, and another with Django 
(https://www.ibm.com/blogs/bluemix//getting-started-django-ibm-cloud/). I 
could not  understand how this is working... 
I don't have enough technical background to start discussing with IBM about 
the robustness of their server. All what I see is that up to now, I 
couldn't get any technical support from them despite my attempt...

Antony, I appreciate your support very much! Thanks!
Serge

Le mercredi 4 juillet 2018 19:59:23 UTC+2, Anthony a écrit :
>
> Not sure if this is the only problem, but in run.sh, the call to web2py.py 
> in the "else" block does not specify an ip address, so it will default to 
> 127.0.0.1, which will run the server on localhost only. You should instead 
> specify "-i 0.0.0.0".
>
> Also, note that this method will serve the app with the web2py built-in 
> web server, which will work but is not intended for heavy production loads. 
> You might want to inquire with IBM Cloud how you can serve a Python web app 
> with a more robust server.
>
> Anthony
>
> On Wednesday, July 4, 2018 at 12:03:31 PM UTC-4, Serge Bourgeois wrote:
>>
>> July 4, 2018
>> Hello,
>>
>> At first, thanks to all of you for the web2py and all the the dynamic 
>> that you generate around this project!
>>
>> Here is one link to store a recipe could be here for deploying web2py on 
>> IBM Cloud (new name of Bluemix):
>>
>> https://developer.ibm.com/recipes/tutorials/category/web-development/
>>
>> I was hoping to bring my modest contribution, but I didn't succeed. 
>> I 'pushed' the web2py framework alone (hoping to be able to enter the 
>> welcome/default/index function) to my environment.
>>
>> The content of what I have pushed in my IBM Cloud instance is on google 
>> drive here: 
>> https://drive.google.com/open?id=1L2gRyL3LSCZHB8fvIQ8eueDzpTOcAMgZ)
>>
>> Everything looked nice until I tried to connect to the IBM Cloud server's 
>> 'endpoint' is at https://tripkit.eu-gb.mybluemix.net .
>>
>> I got the following error message: '502 BAD Gateway: Registered endpoint 
>> failed to handle the request.'
>>
>> Same error message also with 
>> https://tripkit.eu-gb.mybluemix.net/welcome/default/index
>>
>> As I'm not an IT expert, I don't think I'll be able to solve this alone.
>>
>>
>> This push seems to work well, but in practice, nothing works... 
>>  
>> I think you in advance for any idea / suggestion to help deploying a 
>> web2py on the IBM Cloud. 
>>
>> Should you wish more info about my attempts, simply ask me (phone + 32 
>> 477 33 10 11, mail: serge.b...@yahoo.fr ).
>>
>> Le jeudi 8 mai 2014 14:25:49 UTC+2, Massimo Di Pierro a écrit :
>>>
>>> Thank you Duncan,
>>>
>>> this is very valuable. There should be a setup script for this shipping 
>>> with web2py. Is there any IBM blog wjere we could advertise it?
>>>
>>> Massimo
>>>
>>> On Tuesday, 6 May 2014 19:29:48 UTC-5, duncan macneil wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I've been trying out the www.bluemix.net IBM PaaS. 
>>>>
>>>> It took me a bit of digging to realise there is in fact a Python 
>>>> runtime. But you need a buildpack. The setup is different enough from 
>>>> Heroku to warrant this mini-HowTo:
>>>>
>>>> Step 1:
>>>>
>>>> Use the source version of Web2Py and copy the entire lot into a folder 
>>>> path: 'env/app' so that web2py.py is in the 'app' folder.
>>>>
>>>> Step 2:
>>>>
>>>> You need to have a requirements.txt file in the 'app' folder -- even if 
>>>> it is empty. (Although you might want to add a single li

[web2py] Re: Here's how to run Web2Py on IBM BlueMix

2018-07-04 Thread Serge Bourgeois
July 4, 2018
Hello,

At first, thanks to all of you for the web2py and all the the dynamic that 
you generate around this project!

Here is one link to store a recipe could be here for deploying web2py on 
IBM Cloud (new name of Bluemix):

https://developer.ibm.com/recipes/tutorials/category/web-development/

I was hoping to bring my modest contribution, but I didn't succeed. 
I 'pushed' the web2py framework alone (hoping to be able to enter the 
welcome/default/index function) to my environment.

The content of what I have pushed in my IBM Cloud instance is on google 
drive here: 
https://drive.google.com/open?id=1L2gRyL3LSCZHB8fvIQ8eueDzpTOcAMgZ)

Everything looked nice until I tried to connect to the IBM Cloud server's 
'endpoint' is at https://tripkit.eu-gb.mybluemix.net .

I got the following error message: '502 BAD Gateway: Registered endpoint 
failed to handle the request.'

Same error message also with 
https://tripkit.eu-gb.mybluemix.net/welcome/default/index

As I'm not an IT expert, I don't think I'll be able to solve this alone.


This push seems to work well, but in practice, nothing works... 
 
I think you in advance for any idea / suggestion to help deploying a web2py 
on the IBM Cloud. 

Should you wish more info about my attempts, simply ask me (phone + 32 477 
33 10 11, mail: serge.bourge...@yahoo.fr).

Le jeudi 8 mai 2014 14:25:49 UTC+2, Massimo Di Pierro a écrit :
>
> Thank you Duncan,
>
> this is very valuable. There should be a setup script for this shipping 
> with web2py. Is there any IBM blog wjere we could advertise it?
>
> Massimo
>
> On Tuesday, 6 May 2014 19:29:48 UTC-5, duncan macneil wrote:
>>
>> Hi all,
>>
>> I've been trying out the www.bluemix.net IBM PaaS. 
>>
>> It took me a bit of digging to realise there is in fact a Python runtime. 
>> But you need a buildpack. The setup is different enough from Heroku to 
>> warrant this mini-HowTo:
>>
>> Step 1:
>>
>> Use the source version of Web2Py and copy the entire lot into a folder 
>> path: 'env/app' so that web2py.py is in the 'app' folder.
>>
>> Step 2:
>>
>> You need to have a requirements.txt file in the 'app' folder -- even if 
>> it is empty. (Although you might want to add a single line with just 
>> psycopg2, for example.)
>>
>> Step 3: 
>>
>> You need to have a manifest.yml in the 'en'v folder (top level of the 
>> project) with something like the following content:
>>
>> applications:
>> - host: mycoolapp
>>   name: mycoolapp
>>   command: python web2py.py -a 'yourpassword' -i 0.0.0.0 -p $PORT
>>   path: app
>>   domain: ng.bluemix.net
>>   mem: 128M
>>   buildpack: git://github.com/ephoning/heroku-buildpack-python.git
>>   instances: 1
>>
>> You need to make sure that 'mycoolapp' is changed to be unique and 
>> 'yourpassword' is changed, too, obviously.
>>
>> Step 4:
>>
>> Push this entire 'env' directory to BlueMix by navigating to the 'env' 
>> directory and running:
>>
>> cf push
>>
>> This assumes you have installed the CloudFoundry CLI command line tool, 
>> although it also works if you put all the same resources described above 
>> into an empty/new linked JazzHub git project from BlueMix and simply press 
>> 'Deploy' from the web page provided. Handy.
>>
>> Some points to consider:
>>
>> 1. The file structure will hold and run the default SQLite db internally, 
>> but that's probably not what you want because the files are not 
>> designed/guaranteed to be persistent (flushed with a new/fresh deploy, for 
>> instance). Instead you can add PostgreSQL and use that for data persistence 
>> -- BlueMix gives you a Postgres connection URL, ready to use! You just add 
>> it as a service to the app.
>>
>> 2. If you change instances = 1 to a larger number, then you'll probably 
>> also want to add a Redis service and use Redis for sessions (or a db for 
>> sessions). This will most likely allow people to remain logged in when they 
>> are load balanced via round robin to another instance, but I have not 
>> tested that. (What I *did* test is that you don't stay logged in with 
>> multiple instances running, which suggests for larger-scale apps with 
>> multiple instances running you'l want a central Redis for sessions.)
>>
>> 3. You get a SSL-ready address at something like 
>> https://mycoolapp.ng.bluemix.net (wildcard certificate exists for *.
>> ng.bluemic.net), but since it seems to have some kind of reverse proxy, 
>> Web2Py doesn't detect that the admin is being used under HTTPS: so you 
>> might want to also store errors in the DB, too. The default with Web2Py is 
>> errors in stored the file path. Or modify the app admin to ignore HTTPS 
>> (just remember to use HTTPS when logging in!) 
>>
>> I hope this helps someone. BlueMix is free during Beta. Pricing to be 
>> announced in June, I think. It will be interesting to see what the pricing 
>> is.
>>
>> Overall I think the service is pretty good -- especially if you need 
>> formal DevOps. IBM have made the DevOps thing quite neat in BlueMix. I 
>> 

[web2py] grid: top + button: how to adapt dynamically & translate the title 'add record to database' ?

2018-02-12 Thread Serge Bourgeois

Hello,
The following codes changes dynamically the title of the button on the top 
left of the form in English.
But when I switch to another language (exemple FR), I get the French 
translation of 'Add record to database', and not the translation of what I 
have placed in the title of this button.

Example:
   
form = SQLFOR.smartgrid(db[my_table]..., showbuttontext=False, ...)

if not 'view' in request.args and not 'edit' in request.args and not 
'new' in request.args:
   addbutton = form.element(_title='Add record to database')
   my_table = 'my application table'
   addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
return dict(form = form)
=> in English, the title of the + button is 'Add' + the value of 
db[my_table]._singular : This is perfect!
=> in French, I always get 'Ajout d'un enregistrement', which is the 
translation of 'Add record to database'. : this is not what I want...

I have tried the following, but, same result:
   if not 'view' in request.args and not 'edit' in request.args and not 
'new' in request.args:
   my_title = T('Add record to database)'
   addbutton = form.element(_title= my_title)
   my_table = 'my application table'
   addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
return dict(form = form)

Thanks for any advise for translating the title of the top left '+' button 
when I change if in the controller.

-- 
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: Email from text field while preserving the text format

2017-06-21 Thread Serge Bourgeois
Finally, I could find the solution to my first question. It is in fact very
esay.

Here is my receipe:

Assuming that the content of the text field is in your local variable
my_text_field_content, simply put this in the 'message' variable of the
MAIL() function from gluon.tools:

message = (my_text_field_content, '' + my_text_field_content +
'')

All  the other variables must of course been filled in as usual.

Hoping this can help some members of the community,

Serge

2017-06-21 8:08 GMT+02:00 Serge Bourgeois <serge.bourgeo...@gmail.com>:

>
>
> Le mardi 20 juin 2017 18:24:43 UTC+2, Serge Bourgeois a écrit :
>>
>>
>> I like web2py for the good balance between simplicity and completeness.
>> Most of the time, when I have a question, I can find a response googeling.
>> Today not...
>>
>> I could cope with attachments, but I'm still struggling with rich text
>> fields for the email body. Using BeautifulSoup.BeautifulSoup(my_field).text
>> removes the tags, but the result is not accceptable.
>>
>> So, if there is a helper, I could not find it (or not use it properly).
>> 1. With Mail().send, how to fill the 'message' parameter from a text
>> field (let's say my_field) filled in via the ckeditor widget (which allows
>> also to incluse a mail address or a URL).
>> 2. After getting a response to this first question, if I want to append
>> let's say 2 text fields, I 'm gonna try SPAN(my_first_text_field, BR(),
>> my_second_text_field). Will this work?
>>
>> Thanks in advance for any advice.
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/c1l7rXcJtJ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@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: Email from text field while preserving the text format

2017-06-21 Thread Serge Bourgeois


Le mardi 20 juin 2017 18:24:43 UTC+2, Serge Bourgeois a écrit :
>
>
> I like web2py for the good balance between simplicity and completeness. 
> Most of the time, when I have a question, I can find a response googeling. 
> Today not...
>
> I could cope with attachments, but I'm still struggling with rich text 
> fields for the email body. Using BeautifulSoup.BeautifulSoup(my_field).text 
> removes the tags, but the result is not accceptable.
>
> So, if there is a helper, I could not find it (or not use it properly).
> 1. With Mail().send, how to fill the 'message' parameter from a text field 
> (let's say my_field) filled in via the ckeditor widget (which allows also 
> to incluse a mail address or a URL). 
> 2. After getting a response to this first question, if I want to append 
> let's say 2 text fields, I 'm gonna try SPAN(my_first_text_field, BR(), 
> my_second_text_field). Will this work?
>
> Thanks in advance for any advice.
>

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


mailcode
Description: Binary data


Re: [web2py] Email from text field while preserving the text format

2017-06-20 Thread Serge Bourgeois
Hello Richards,
Thanks for reading my question.

I'll try to clarify what I do and what I need.

I have a table with a text field. Using a SQLFORM.smartgrid, I use the 
ckeditor widget to populate this field, in order to get the data presented 
in a nice format (including for titles, email adresses, and so on).
This works fine.

Now, I want to generate an email with the content of this text field 
preserving the format created by the ckeditor widget.
I can make and send a mail (including with attachments), *BUT:*

When I open my mail, for instance with Firefox Web Browser, *I see the tags 
*used to format the text such as  .* My text is not formated* as 
expected, and I see a series of special characters around email addresses 
or any url.

I found a way to suppress the tags and special chararcters using 
BeautifullSoup.BeautifullSoup, but then the result (what I read in Firefox 
Web Browser) looks like a long word (everything is concatenated, the url 
links are lost,. Therefore I say this is not acceptable).

I couldn't find a solution to get retrieve my formated text in Firefox Web 
Browser using the gluon Mail function. This is what I need.

As I am far from being an IT expert, I guess I missed or misunderstood 
something. 

Serge



Le mardi 20 juin 2017 21:53:14 UTC+2, Richard a écrit :
>
> Hello Serge,
>
> It not clear what you are doing exactly, do you mean you parse text with 
> BeautifulSoup before input it into the database field? And what is 
> unacceptable?
>
> About 1, I think previous question would help understand better the issue.
>
> About 2, I don't see why it wouldn't work... But as I am not sure what you 
> try to accomplish, I mean if you strip off tag with beatiful in the first 
> place why add some tag back when you send the message...
>
> I am sure we would benefit to see a bit of your code to bettter help you.
>
> Note that HTML in email is a difficult topic as render engine are much 
> less homogeneous in email client like outlook, thunderbird than what you 
> may have from a normal browser. So having the right presentation everywhere 
> is more difficult to achieve than a regular web page.
>
> Good Luck
>
> Richard
>
> On Tue, Jun 20, 2017 at 12:24 PM, Serge Bourgeois <serge.bo...@gmail.com 
> > wrote:
>
>>
>> I like web2py for the good balance between simplicity and completeness. 
>> Most of the time, when I have a question, I can find a response googeling. 
>> Today not...
>>
>> I could cope with attachments, but I'm still struggling with rich text 
>> fields for the email body. Using BeautifulSoup.BeautifulSoup(my_field).text 
>> removes the tags, but the result is not accceptable.
>>
>> So, if there is a helper, I could not find it (or not use it properly).
>> 1. With Mail().send, how to fill the 'message' parameter from a text 
>> field (let's say my_field) filled in via the ckeditor widget (which allows 
>> also to incluse a mail address or a URL). 
>> 2. After getting a response to this first question, if I want to append 
>> let's say 2 text fields, I 'm gonna try SPAN(my_first_text_field, BR(), 
>> my_second_text_field). Will this work?
>>
>> Thanks in advance for any advice.
>>
>> -- 
>> 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] Email from text field while preserving the text format

2017-06-20 Thread Serge Bourgeois

I like web2py for the good balance between simplicity and completeness. 
Most of the time, when I have a question, I can find a response googeling. 
Today not...

I could cope with attachments, but I'm still struggling with rich text 
fields for the email body. Using BeautifulSoup.BeautifulSoup(my_field).text 
removes the tags, but the result is not accceptable.

So, if there is a helper, I could not find it (or not use it properly).
1. With Mail().send, how to fill the 'message' parameter from a text field 
(let's say my_field) filled in via the ckeditor widget (which allows also 
to incluse a mail address or a URL). 
2. After getting a response to this first question, if I want to append 
let's say 2 text fields, I 'm gonna try SPAN(my_first_text_field, BR(), 
my_second_text_field). Will this work?

Thanks in advance for any advice.

-- 
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] Smartgrid: get the ID of the just inserted row

2015-10-27 Thread Serge Bourgeois

When creating a new record with smartgrid, the   the 'onvalidation' 
function cannot give the form.vars.id is since the record is not created 
yet. 
I understand that the onvalidation para allow to control what happens 
before the form is accepted, but I confess I couldnt' find a kind of 
'after_validation'. 
In fact, I'd like to create and insert thumbnails automatically when 
creating new record. For this, I neew the id of the record, just after 
creation, as for instance described at the page 145 of the book 'web2py 
application development cookbook' of Marino Reingart, Pablo Martin Mulone, 
Massimo Di Pierro, Bruno Cezar Rocha, ... ,in the function ' : 
make_thumbnail

Thanks in advance for any help!





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


[web2py] Re: Smartgrid: get the ID of the just inserted row

2015-10-27 Thread Serge Bourgeois
Thanks! oncreate is working perfectly!

Le mardi 27 octobre 2015 11:54:46 UTC+1, Serge Bourgeois a écrit :
>
>
> When creating a new record with smartgrid, the   the 'onvalidation' 
> function cannot give the form.vars.id is since the record is not created 
> yet. 
> I understand that the onvalidation para allow to control what happens 
> before the form is accepted, but I confess I couldnt' find a kind of 
> 'after_validation'. 
> In fact, I'd like to create and insert thumbnails automatically when 
> creating new record. For this, I neew the id of the record, just after 
> creation, as for instance described at the page 145 of the book 'web2py 
> application development cookbook' of Marino Reingart, Pablo Martin Mulone, 
> Massimo Di Pierro, Bruno Cezar Rocha, ... ,in the function ' : 
> make_thumbnail
>
> Thanks in advance for any help!
>
>
>
>
>
>

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


Re: [web2py] Re: ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-10 Thread Serge Bourgeois
I'd like to share the solution I found (maybe not the best?), in case it 
could be usefull to other:

1. collapse the top bar  either with editing the 
app/static/plugin_ckeditor/config.js 
file like this:

CKEDITOR.editorConfig = function( config ) 

{ 

// Define changes to default configuration here. For example: 

// config.language = 'fr'; 

// config.uiColor = '#AADC6E'; 

config.toolbarStartupExpanded = false; // added to callapse the top toolbar

};

or by adding this script in the views where you want to hide the top 
toolbar (more flexible, since you can easily control when it has to be 
triggered in the view)

script

window.onload = function hide_cke_top() {

var my_list = document.getElementsByClassName(cke_top); // hide top tool 
bar. 

for (var i = 0; i  my_list.length; i++) {

my_list[i].className +=   + hide;

};

};

/script
2. In the controller : db.my_table.my_text_field.represent = lambda value, 
row: ckeditor.widget(db.my_table.my_text_field, value, **{'_id': 
'ckeditor_row_%s' % row.id, '_name':'my_text_field_row_%s' % row.id }) if 
(.. here your condition to make the field editable) else 
(ckeditor.widget(db.my_table.my_text_field, 
value, **{'_id': 'ckeditor_row_%s' % row.id,'_name':'my_text_field_row_%s' 
% row.id, '_disabled' : 'disabled' }))

Hope this can help...
Serge

Le mardi 3 février 2015 10:13:26 UTC+1, Serge Bourgeois a écrit :

 If I could find a way to add a way to change, in the view this 

 td id=cke_top_my_table_my_field class=cke_top 
 role=presentationdiv class=cke_toolbox role=group 
 aria-labelledby=cke_6 onmousedown=return false;span id=cke_6  

 by this:

 td id=cke_top_my_table_my_field class=cke_top hide 
 role=presentationdiv 
 class=cke_toolbox role=group aria-labelledby=cke_6 
 onmousedown=return false;span id=cke_6 

 then I woujld add this in the style definition of layout.html 

 .hide {display:none !important;}

 and it would work...

 Any suggestion on how I could add 'hide' in the class?

 2015-02-03 10:02 GMT+01:00 Serge Bourgeois serge.bourgeo...@gmail.com:

 Thanks for your response.

 The solution I'm looking for should preserve the way ckeditor displays 
 the text. 

 Based on you idea, I tried this in my controller:

 db.my_table.my_field.represent = lambda value, row: 
  ckeditor.widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s' 
 % row.id }) if 'new' in request.args or 'edit' in request.args  else 
 text_widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s' % 
 row.id}).add_class('width250px' 'height50px')

 ( .. I added widht250px and height50px in the head of layout.html)
  
 Mybe I missed some points in your suggestion ?
 The result of this test leads to loosing the text format and displaying 
 the tags ... 

 Example of what displays on the screen for 'my_field':

 p
 This is my text strongthis is a strong text including an 
 image:nbsp;img alt= 
 src=/prj/default/download/plugin_ckeditor_upload.upload.bfe9ba00ebcb13a7.44657365727665546f42654c6f7665642e6d7033.mp3
  
 //strong/p
 p
 nbsp;/p



 2015-02-02 12:13 GMT+01:00 Tim Nyborg tim.nyb...@gmail.com:

 Depends on how you're implementing the widget.

 I've got a CKEditor widget as follows (pretty much a glorified copy of 
 text.widget with the ckeditor class):

 class CKEditor(FormWidget):
 _class = 'ckeditor' 

 @classmethod
 def widget(cls, field, value, **attributes):
  
 generates a TEXTAREA tag. 
 
 see also: :meth:`FormWidget.widget`
  
 default = dict(value=value) 
 attr = cls._attributes(field, default, **attributes) 
 return TEXTAREA(**attr) 

 Used in the model, it's:

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=CKEditor.widget)
 )  

 So to do what you're suggesting, I change it to:

 def hideable_ckeditor_widget():
 return SQLFORM.widgets.text.widget if 'new' in request.args or 
 'edit' in request.args else CKEditor.widget

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=hideable_ckeditor_widget())
 )  



 On Sunday, February 1, 2015 at 9:25:35 AM UTC, Serge Bourgeois wrote:

 I just implemented the ckeditor plugin. It looks great, but I need help 
 (example if possible) showing how to hide the ckeditor toolbar for some 
 text fields, for instance in a controller with a smartgrid, where 
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge

  -- 
 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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/tnDhxZZLfdI/unsubscribe.
 To unsubscribe from this group

Re: [web2py] Re: ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-03 Thread Serge Bourgeois
Thanks for your response.

The solution I'm looking for should preserve the way ckeditor displays the
text.

Based on you idea, I tried this in my controller:

db.my_table.my_field.represent = lambda value, row:
 ckeditor.widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s'
% row.id }) if 'new' in request.args or 'edit' in request.args  else
text_widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s' %
row.id}).add_class('width250px' 'height50px')

( .. I added widht250px and height50px in the head of layout.html)

Mybe I missed some points in your suggestion ?
The result of this test leads to loosing the text format and displaying the
tags ...

Example of what displays on the screen for 'my_field':

p
This is my text strongthis is a strong text including an image:nbsp;img
alt=
src=/prj/default/download/plugin_ckeditor_upload.upload.bfe9ba00ebcb13a7.44657365727665546f42654c6f7665642e6d7033.mp3
//strong/p
p
nbsp;/p



2015-02-02 12:13 GMT+01:00 Tim Nyborg tim.nyb...@gmail.com:

 Depends on how you're implementing the widget.

 I've got a CKEditor widget as follows (pretty much a glorified copy of
 text.widget with the ckeditor class):

 class CKEditor(FormWidget):
 _class = 'ckeditor'

 @classmethod
 def widget(cls, field, value, **attributes):
 
 generates a TEXTAREA tag.

 see also: :meth:`FormWidget.widget`
 
 default = dict(value=value)
 attr = cls._attributes(field, default, **attributes)
 return TEXTAREA(**attr)

 Used in the model, it's:

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=CKEditor.widget)
 )

 So to do what you're suggesting, I change it to:

 def hideable_ckeditor_widget():
 return SQLFORM.widgets.text.widget if 'new' in request.args or 'edit'
 in request.args else CKEditor.widget

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=hideable_ckeditor_widget())
 )



 On Sunday, February 1, 2015 at 9:25:35 AM UTC, Serge Bourgeois wrote:

 I just implemented the ckeditor plugin. It looks great, but I need help
 (example if possible) showing how to hide the ckeditor toolbar for some
 text fields, for instance in a controller with a smartgrid, where
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/tnDhxZZLfdI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@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.


Re: [web2py] Re: ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-03 Thread Serge Bourgeois
If I could find a way to add a way to change, in the view this

td id=cke_top_my_table_my_field class=cke_top role=presentationdiv
class=cke_toolbox role=group aria-labelledby=cke_6
onmousedown=return false;span id=cke_6

by this:

td id=cke_top_my_table_my_field class=cke_top hide
role=presentationdiv
class=cke_toolbox role=group aria-labelledby=cke_6
onmousedown=return false;span id=cke_6

then I woujld add this in the style definition of layout.html

.hide {display:none !important;}

and it would work...

Any suggestion on how I could add 'hide' in the class?

2015-02-03 10:02 GMT+01:00 Serge Bourgeois serge.bourgeo...@gmail.com:

 Thanks for your response.

 The solution I'm looking for should preserve the way ckeditor displays the
 text.

 Based on you idea, I tried this in my controller:

 db.my_table.my_field.represent = lambda value, row:
  ckeditor.widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s'
 % row.id }) if 'new' in request.args or 'edit' in request.args  else
 text_widget(db.my_table.my_field, value, **{'_name':'my_field_row_%s' %
 row.id}).add_class('width250px' 'height50px')

 ( .. I added widht250px and height50px in the head of layout.html)

 Mybe I missed some points in your suggestion ?
 The result of this test leads to loosing the text format and displaying
 the tags ...

 Example of what displays on the screen for 'my_field':

 p
 This is my text strongthis is a strong text including an
 image:nbsp;img alt=
 src=/prj/default/download/plugin_ckeditor_upload.upload.bfe9ba00ebcb13a7.44657365727665546f42654c6f7665642e6d7033.mp3
 //strong/p
 p
 nbsp;/p



 2015-02-02 12:13 GMT+01:00 Tim Nyborg tim.nyb...@gmail.com:

 Depends on how you're implementing the widget.

 I've got a CKEditor widget as follows (pretty much a glorified copy of
 text.widget with the ckeditor class):

 class CKEditor(FormWidget):
 _class = 'ckeditor'

 @classmethod
 def widget(cls, field, value, **attributes):
 
 generates a TEXTAREA tag.

 see also: :meth:`FormWidget.widget`
 
 default = dict(value=value)
 attr = cls._attributes(field, default, **attributes)
 return TEXTAREA(**attr)

 Used in the model, it's:

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=CKEditor.widget)
 )

 So to do what you're suggesting, I change it to:

 def hideable_ckeditor_widget():
 return SQLFORM.widgets.text.widget if 'new' in request.args or
 'edit' in request.args else CKEditor.widget

 idb.define_table(
 'module',
 Field('id', 'id', readable=False),
 ...
 Field('description', 'text', widget=hideable_ckeditor_widget())
 )



 On Sunday, February 1, 2015 at 9:25:35 AM UTC, Serge Bourgeois wrote:

 I just implemented the ckeditor plugin. It looks great, but I need help
 (example if possible) showing how to hide the ckeditor toolbar for some
 text fields, for instance in a controller with a smartgrid, where
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/tnDhxZZLfdI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@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.


Re: [web2py] ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-02 Thread Serge Bourgeois
in stead of 'now' and 'edit', read 'new' or 'edit' ...

2015-02-01 10:25 GMT+01:00 Serge Bourgeois serge.bourgeo...@gmail.com:

 I just implemented the ckeditor plugin. It looks great, but I need help
 (example if possible) showing how to hide the ckeditor toolbar for some
 text fields, for instance in a controller with a smartgrid, where
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge

 --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/tnDhxZZLfdI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@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] ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-01 Thread Serge Bourgeois
I just implemented the ckeditor plugin. It looks great, but I need help 
(example if possible) showing how to hide the ckeditor toolbar for some 
text fields, for instance in a controller with a smartgrid, where 
request.args does not contain 'now' nor 'edit'.
Thanks in advance !
Serge

-- 
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] file transfer from client to server with @service.soap and store on server

2014-07-24 Thread Serge Bourgeois
Hello,

I am looking for support to interface 2 web2py applications via
@service.soap

app1: is running on portable device, has a table with a field
(Field('f_assest', type 'upload')), used to store files such as jpeg, zip
or pdf files. This app1 can run on stand alone, not connected device, but,
when the user decides so, should send some info to app2. The files stored
in le 'uploads' directory of app1 in are small (typically 0.5 MB).

app2: running on a central server (@ getup).

For interfacing app1 = app2, I try to use the @service.soap.

And there, I am facing some problems on the client side, and others on the
server side.

*On the client side (app1)*:

- I cannot find a correct and efficient way(not taking too much time...) to
integrate my 'f_assest' field in the dictionary structure, and I am not
sure about the message coding requirements.

Assuming the value of the file name is the variable my_f_assest_value, here
is what I do :

path = os.path.join(request.folder,'uploads',my_f_assest_value)
myfile = open(path, rb)
myline['x_file_content']= unicode(myfile.read())
myfile.close()

*On the server side (app2)*:

I want to integrate myline['x_file_content'] in a table (my table name =
db.t_txp_expense_line)

First I create the record in my table with the other attributes transferred
from my client correctly beside ['x_file_content']
myline_id = db.t_txp_expense_line.insert(
f_expense = myexpense_id,
is_active = 'T',
created_on = request.now,
modified_on = request.now,
created_by = myuser_id,
modified_by = myuser_id,
f_date = mydate)

This creation works fine... Initially, I tried to merge the next step with
this one, but everything was blocking...

In the next step, I check if there is something in the variable
['x_file_content'], and if so, I update the record just created before...
To make it easier for my first test, I imposed the filename to
'myfilename', which is up to now, not existing in my uploads directory.
The following instructions DO NOT WORK... The file is not uploaded, and the
record not updated. It seems to loop indefinitely...

if (['x_file_content']) : # Is there any file to upload?
   db(db.t_txp_expense_line.id == myline_id).update(f_assest =
db.t_txp_expense_line.f_assest.store(cStringIO.StringIO(str(['x_file_content'])),
'myfilename'))

I am not at all an it expert. So, I confess I am struggling with *streaming*
and *coding/uncoding* features which might also be critical to store data
into the dictionary structure on the client side, and to send them safely
from the client to the server...

Thanks in advance for any advise / support.

Serge

-- 
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: Direct editing inside a grid

2014-07-18 Thread Serge Bourgeois
Hello,

I could sort it out...

For those who could be interrested, here under the key elements of my 
solution.

1. In the model, create the following functions (here for string and drop 
list):

def options_widget(field,value,**kwargs):
return 
SQLFORM.widgets.options.widget(field,value,_class=generic-widget,**kwargs)

def string_widget(field,value,**kwargs):
return 
SQLFORM.widgets.string.widget(field,value,_class='string',**kwargs )


In the controller, in the function that you want to contain the editing 
grid:
def my_function_name(): # here my tale name = t_txw_expense_template
if len(request.post_vars) 0:
for key, value in request.post_vars.iteritems():
(field_name,sep,row_id) = key.partition('_row_') # field_name 
will look like field_name_row_99
if row_id:
db(db.t_txw_expense_template.id == 
row_id).update(**{field_name:value})
   # the name of the attribute is used to know which row is involved

# for each field that you want to see:

db.t_txw_expense_template.f_expense_template.represent = lambda value, 
row: string_widget(db.t_txw_expense_template.f_expense_template, value,

  **{'_name':'f_expense_template_row_%s' % row.id})

db.t_txw_expense_template.f_header.represent = lambda value, row: 
string_widget(db.t_txw_expense_template.f_header, value,   

  **{'_name':'f_header_row_%s' % row.id})

db.t_txw_expense_template.f_project.represent = lambda value, row: 
options_widget(db.t_txw_expense_template.f_project, value,   

  **{'_name':'f_project_row_%s' % row.id})

 # and so on...
 form = SQLFORM.smartgrid(db.t_txw_expense_template, # and so on...
# selectable = dict(t_txw_expense_template= 
None)
 selectable= lambda ids : 
redirect(URL('my_function_name',vars=request._get_vars)),   
   
 )
  #remove selectable's checkboxes
form.elements(_type='checkbox',_name='records',replace=None)
return dict (form = form)
Hope this can help...

Le jeudi 17 juillet 2014 21:57:12 UTC+2, Anthony a écrit :

 I don't have time to look into it, but seeing some code and a traceback 
 might help.

 Anthony

 On Thursday, July 17, 2014 12:18:39 PM UTC-4, Serge Bourgeois wrote:

 Thanks Antony!. Do you know if there is any plan to develop such a 
 feature? If yes, do you have any idea of availability ? 

 Still a third question: I tried the idea proposed here : 


 http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript

 but, I got a message saying that I couldn't change the objects already 
 existing ... (I guess the name of the fields, even with migrate == False). 

 Maybe you have any good idea to turn around this issue?

 Serge
  

 Le jeudi 17 juillet 2014 17:21:05 UTC+2, Anthony a écrit :

 This is not available out of the box, though it would be nice.

 Anthony

 On Thursday, July 17, 2014 10:25:20 AM UTC-4, Serge Bourgeois wrote:

 Hello,

 In order to simplify the user interface of basic controller functions, 
 I want to offer direct editing in SQLFORM.smartgrid, using the same 
 widgets 
 (string, options, uploads, ...) than those available in create or edit. 

 Maybe, I missed the point in the doc?

 Thank you for any advice.

 Serge



-- 
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] Direct editing inside a grid

2014-07-17 Thread Serge Bourgeois
Hello,

In order to simplify the user interface of basic controller functions, I 
want to offer direct editing in SQLFORM.smartgrid, using the same widgets 
(string, options, uploads, ...) than those available in create or edit. 

Maybe, I missed the point in the doc?

Thank you for any advice.

Serge

-- 
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: Direct editing inside a grid

2014-07-17 Thread Serge Bourgeois
Thanks Antony!. Do you know if there is any plan to develop such a feature? 
If yes, do you have any idea of availability ? 

Still a third question: I tried the idea proposed here : 

http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript

but, I got a message saying that I couldn't change the objects already 
existing ... (I guess the name of the fields, even with migrate == False). 

Maybe you have any good idea to turn around this issue?

Serge
 

Le jeudi 17 juillet 2014 17:21:05 UTC+2, Anthony a écrit :

 This is not available out of the box, though it would be nice.

 Anthony

 On Thursday, July 17, 2014 10:25:20 AM UTC-4, Serge Bourgeois wrote:

 Hello,

 In order to simplify the user interface of basic controller functions, I 
 want to offer direct editing in SQLFORM.smartgrid, using the same widgets 
 (string, options, uploads, ...) than those available in create or edit. 

 Maybe, I missed the point in the doc?

 Thank you for any advice.

 Serge



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


[web2py] how to leave mobile interface testing...

2014-05-20 Thread Serge Bourgeois
Sorry for this stupid question: where is the option to stop testing mobile 
interface on a normal PC? 
In other words how to get back to a 'normal' interface once you tried the 
mob interface?

Thanks in advance .
Serge

-- 
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] smartgrid : editing a subtable containing field representation creates an internal error

2013-12-31 Thread Serge Bourgeois
Hi,
I have an issue I cannot resolve. As I am not an expert, this is probably a 
personal bug (a 'stupid error'...). 
Thank in advance for any help.

Here is how this happens...

1. My db model has 2 tables and 2 rendering functions...

 def render_company(f_company = None, row = None):

  myreturn = ''

  if f_company:

 mycompany = db.t_txp_company(f_company)

 myreturn = mycompany.f_company

  return myreturn


 def render_employee(f_employee = None, row = None):

  myreturn = ''

  if f_employee:

   myuser = db.auth_user(f_employee)

   myreturn = myuser.first_name + ' ' + myuser.last_name

  return myreturn


 db.define_table('t_txp_company', Field('f_company'))

db.define_table('t_txp_employee',

Field('f_company', 'reference t_txp_company'),

Field('f_employee', 'reference auth_user'))

db.t_txp_employee.f_company.represent = render_company

db.t_txp_employee.f_employee.represent = render_employee

2. My controller has a single smartgrid function

 @auth.requires_login()

def company():

  formcompany = SQLFORM.smartgrid(db.t_txp_company)

  return dict(formcompany=formcompany)

3. How my error occurs...

 - From the company smartgrid function, I create a companyn and then I 
create an employee for this company : this works fine

- Coming back to employee level, the rendering functions also work 
correctly (auth first name and last name are ok). 

- But at that level, if I want to view or edit the employee by clicking on 
the 'Edit' button , then you I get the following error ticket...

type 'exceptions.RuntimeError' field representation must take 1 or 2 args


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


Re: [web2py] Re: version2.5.1:Approximative date of version correcting smartgrid with links to several tables

2013-06-18 Thread Serge Bourgeois
 smartgrids with linked_tables cannot be executed.

As the problem has already been reported (Antony reacted on it proposing to
include this situation in the non regression testing), I didn't document my
own case.

Serge


2013/6/17 Massimo Di Pierro massimo.dipie...@gmail.com

 I am not aware of this. What is the problem with smartgrid in 2.5.1?


 On Monday, 17 June 2013 03:08:02 UTC-5, Serge Bourgeois wrote:

 At first, thanks a lot for the fantastic work around Web2py. Each time a
 new version come, I iplemented it with excitation...
 The last version 2.5.1 came with a regression in smartgrid
 functionalities. As I use smartgird in many situation, I'd like to know
 approximatively when the correction is planned to be implemented.
 Thanks again for your efforts.

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/HpqRd_bK9GY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

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




Re: [web2py] Re: redirecting to localhost or 127.0.0.1

2013-06-18 Thread Serge Bourgeois
Thanks Antony!


2013/6/14 Anthony abasta...@gmail.com

 The URL host name is part of request.client, which is used as the prefix
 for the session ID -- so switching from localhost to 127.0.0.1 causes a new
 session ID (and therefore session file) to be created.

 Anthony


 On Friday, June 14, 2013 4:26:21 AM UTC-4, Serge Bourgeois wrote:


 I tought that localhost and 127.0.0.1 were equivalent, but it looks not.
 I 'd like to understand the difference.

 After auth authentification in a CAS, the system redirects correcty to
 localhost:8000/myapp/default/**index.
 Now, in a controller action, if I redirect again, for instance to
 127.0.0.1:8000/myapp/**myactionfile/myactionhttp://127.0.0.1:8000/myapp/myactionfile/myaction,
 then auth.user.id seems to be lost. And if myactionfile/myaction is
 decorated with @auth.requires_login(), the user has to identify again

 Thanks for any clarification on this subject.

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/bS0znedc19U/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

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




[web2py] version2.5.1:Approximative date of version correcting smartgrid with links to several tables

2013-06-17 Thread Serge Bourgeois
At first, thanks a lot for the fantastic work around Web2py. Each time a 
new version come, I iplemented it with excitation...
The last version 2.5.1 came with a regression in smartgrid functionalities. 
As I use smartgird in many situation, I'd like to know approximatively when 
the correction is planned to be implemented.
Thanks again for your efforts.

-- 

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




[web2py] redirecting to localhost or 127.0.0.1

2013-06-14 Thread Serge Bourgeois

I tought that localhost and 127.0.0.1 were equivalent, but it looks not. I 
'd like to understand the difference.

After auth authentification in a CAS, the system redirects correcty to 
localhost:8000/myapp/default/index.
Now, in a controller action, if I redirect again, for instance to 
127.0.0.1:8000/myapp/myactionfile/myaction, then auth.user.id seems to be 
lost. And if myactionfile/myaction is decorated with 
@auth.requires_login(), the user has to identify again

Thanks for any clarification on this subject.

-- 

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




[web2py] How to display field containing html tags in viewer using the {{=}}python instruction?

2013-04-11 Thread Serge Bourgeois

My question is certainly trivial, but I cannot find any answer on the web...

I try to display a field (let's say myfield)containing html tags in viewer 
using {{=myfield}}.

Example of content: 

lt;body style= font-family:'Ubuntu'; font-size:11pt; font-weight:400; 
font-style:normal;
lt;p style= margin-top:0px; margin-bottom:0px; margin-left:0px; 
margin-right:0px; -qt-block-indent:0; text-indent:0px;...blablabla (this 
is my business data)... lt;/plt;/body
 
My problem: what I get displayed is the whole field content, including the 
tags.
I would like the tags to be 'captured and understood' by the web browser 
and not included as part of my business data.

Thanks in advance for any suggestion.

-- 

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