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

2020-08-18 Thread AGRogers
I am completely out of my depth re this issue. But I just read the
following on the py4web group and wondered whether it might be related.

Proper use of modules
Q from Richard: Where do modules go?
A I think proper modules should be installed with pip but if you want to
distribute the source of
your own pure python module with an app I say place it under a new folder
apps/yourapp/modules and make sure there is an "__init__.py" in there. Do
not install it in
the path otherwise may interfere with modules with similar names used by
other apps in the
same apps. Related Q: So "__init__.py" lives in apps/yourapp/modules? A:
Not any module
will work this way. files in the module must use the "from . xyz import"
notation and not
"from thismodule import" notation
Any subfolder of an app that contains python code should have an __init__.py
empty one


On Wed, 19 Aug 2020, 12:05 am Kevin Keller,  wrote:

> I see there is an open issue on git from 8 days ago:
>
> https://github.com/web2py/web2py/issues/2341
>
> So just FYI it is already reported.
>
> Its a strange error.
>
> Must be somewhere in the module save function and after save it should
> trigger the compile which obviously does not work anymore either.
>
> Should be a small thing
>
> Am Di., 18. Aug. 2020 um 15:56 Uhr schrieb xgp.l...@gmail.com <
> xgp.lat...@gmail.com>:
>
>> Hi,
>>
>> I already open a conversation about this but no complete answers were
>> given.
>> I ran from source and experience the same error.
>>
>>
>> Cheers,
>>
>> El Tuesday, August 18, 2020 a la(s) 8:52:43 AM UTC-5, kell...@gmail.com
>> escribió:
>>
>>> Same issue here with newest web2py
>>>
>>> Am Di., 18. Aug. 2020 um 07:08 Uhr schrieb 'Annet' via web2py-users <
>>> web...@googlegroups.com>:
>>>
 I reported the same problem some time ago.

 When I edit a module and save it I get this nameError. Since I am
 importing the modules into other applications I have to restart web2py
 everytime I edit a module.

 Further more the module are no longer compiled on first use, which
 I also find very annoying.

 Annet

 Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:

> same error, though with a lot more than 3 lines
>
> On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com
> wrote:
>
>>
>> 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+un...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/web2py/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%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/df07ae0b-2ffa-453d-a481-363567f9b6f6n%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
> 

Re: [web2py] Re: Server SQL non existent or access denied

2020-08-18 Thread AGRogers
Hi Andrea

According to
https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-3-proof-of-concept-connecting-to-sql-using-pyodbc?view=sql-server-ver15

*pyODBC uses* the *Microsoft ODBC* driver for SQL Server. If your version
of the *ODBC* driver *is* 17.1 or later, you *can use* the Azure Active
Directory interactive mode of the *ODBC* driver through *pyODBC*.

The numbers might not match yours but the concept should be the same -
pyodbc goes through Microsoft odbc.

It's been a while since I have done something with any odbc driver. But my
first step would be ensuring Microsoft ODBC is working fine. Maybe you have
done that already. I used to just create a connection from, say, MS Office
or Access and verify that I could read the data I needed. Then I would move
onto whatever app it was that I was trying to set up with odbc.




On Sun, 16 Aug 2020, 7:46 pm Andrea Fae',  wrote:

> Hello Villas, first thanks so much. You are gently.
> I will have possibility tomorrow to test. I just installed ODBC driver 17
> in my client, so tomorrow I will test first of all if with a windows DSN
> connection it's possible to connect to SQL server 2016. After it I will try
> using web2py...But I don't know the implication about windows ODBC driver,
> pyodbc (it's another odbc driver...so independent from windows ODBC driver
> I think), and I don't know exactly if my DAL syntax is correct or not,
> because I found different syntax in the web.
> If there will be anyone who could help me I will be very grateful.
> Thank you so much Villas!!
>
> Il giorno sabato 15 agosto 2020 17:27:41 UTC+2, villas ha scritto:
>>
>> >> Do I have to install any ODBC SQL Server Driver on my client?
>>
>> Hi Andrea
>> I feel your frustration and, although I do not use mssql,  I believe you
>> will certainly require a suitable ODBC driver installed so you can then
>> connect to that datasource using pyobc.
>> Maybe this will help  https://github.com/mkleehammer/pyodbc/wiki
>> Note that you should be able to use the pyodbc library independently from
>> web2py.
>> I hope that other mssql users can give better advice.
>> All the best
>>
>> --
> 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/a3fd7654-838e-416b-b7f6-8c531388979ao%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/CACWMBMPttU-_pmRy3Upsi7ZaZNEeueg41g0ORD_PfEyX%2BZtxbA%40mail.gmail.com.


Re: [web2py] Re: Nested menu item

2020-08-18 Thread AGRogers
I'm pretty sure that bootstrap doesn't allow nesting menus more than a
single level. If you need more you need to use a custom menu system.

I'm not sure how that applies to web2py's menu system. But I suspect it too
only accommodates a single level by design.

On Wed, 19 Aug 2020, 7:24 am Vlad,  wrote:

> I may be missing something, but it seems to me that by design MENU helper
> produces regular, simple menu code, as it's not bootstrap-enabled by
> itself. I mean, this was my assumption to begin with; that's why I haven't
> even tried it - rather setting up menu as a list  of items  (i.e. data
> structure to be used in menu, which by default belongs to menu.py) and in
> layout.html I create an explicit bootstrap menu, iterating over the list,
> using appropriate html code, and this is how I use it.
>
> On Tuesday, August 18, 2020 at 4:55:06 AM UTC-4 Annet wrote:
>
>> Hi,
>>
>> I've got a two level menu, however, calling
>>
>> {{=MENU(response.app_menu)}}
>>
>> doesn't render a Bootstrap 4 menu like your resulting html code. It
>> renders something pretty ugly:
>>
>> 
>>   
>> > class="fas fa-home">
>> 
>> 
>>   Our network
>>   Networks we joined
>>  
>>
>>   
>>  
>>
>>
>> Do you have any idea how to solve this issue?
>>
>> Kind regards,
>>
>> Annet
>>
>> Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:
>>
>>> Missing something basic, but seems to me that the following code should
>>> result in nested menu:
>>>
>>> response.menu = [['One', False, 'link1',
>>>   [
>>> ['Two', False, None,
>>>['Three', False, 'link3']
>>> ]
>>>   ]
>>>  ]
>>> ]
>>>
>>> "One" menu items contains "two", as it should, but "two" comes out to be
>>> a simple menu item, not containing "three" in it. What's missing?? How do I
>>> make nested sub-menu items?
>>>
>>> Here is the resulting html, where "three" sub-item is not even present:
>>>
>>> 
>>>  >> >One
>>>  
>>>   Two
>>>  
>>> 
>>>
>>>
>>>
>>>
>>> --
> 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/ac140d58-8f06-4455-b4e0-b9dd9fd028a0n%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/CACWMBMMtf_P0KpggAXXn2kvvT5DCZniofakB3ZSnYU9eKSQ9ww%40mail.gmail.com.


[web2py] Re: Nested menu item

2020-08-18 Thread Vlad
I may be missing something, but it seems to me that by design MENU helper 
produces regular, simple menu code, as it's not bootstrap-enabled by 
itself. I mean, this was my assumption to begin with; that's why I haven't 
even tried it - rather setting up menu as a list  of items  (i.e. data 
structure to be used in menu, which by default belongs to menu.py) and in 
layout.html I create an explicit bootstrap menu, iterating over the list, 
using appropriate html code, and this is how I use it. 

On Tuesday, August 18, 2020 at 4:55:06 AM UTC-4 Annet wrote:

> Hi,
>
> I've got a two level menu, however, calling 
>
> {{=MENU(response.app_menu)}}
>
> doesn't render a Bootstrap 4 menu like your resulting html code. It
> renders something pretty ugly:
>
> 
>   
>  class="fas fa-home">
> 
> 
>   Our network
>   Networks we joined
>  
>
>   
>  
>
>
> Do you have any idea how to solve this issue?
>
> Kind regards,
>
> Annet
>
> Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:
>
>> Missing something basic, but seems to me that the following code should 
>> result in nested menu:
>>
>> response.menu = [['One', False, 'link1',
>>   [
>> ['Two', False, None,
>>['Three', False, 'link3']
>> ]
>>   ]
>>  ]
>> ]
>>
>> "One" menu items contains "two", as it should, but "two" comes out to be 
>> a simple menu item, not containing "three" in it. What's missing?? How do I 
>> make nested sub-menu items? 
>>
>> Here is the resulting html, where "three" sub-item is not even present: 
>>
>> 
>>  
>> One
>>  
>>   Two
>>  
>> 
>>
>>
>>
>>
>>

-- 
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/ac140d58-8f06-4455-b4e0-b9dd9fd028a0n%40googlegroups.com.


[web2py] Re: DAL Could not create constraint or index

2020-08-18 Thread villas
I presume therefore that you need those fields.  This is the kind of thing 
I do to get things working.  Please forgive me if I've missed something.

   - I would create those required fields manually in your database 
   (without the constraint that causes the problem).
   - Set auth.define_tables(migrate = True, fake_migrate=True)
   - Run the app.  This will create the .table definition file in the 
   databases dir.  You may have had to delete the old .table file.  If 
   necessary delete that.
   - Set auth.define_tables(migrate =False) again.


Sorry if this seems strange, but it is a work around solution.
I am hoping that someone will eventually fix this contraint problem in 
pyDal.


On Tuesday, 18 August 2020 20:51:57 UTC+1, Andrea Fae' wrote:
>
> Thank you Villas. I'm using option 2 and now I have the tables without 
> "created_by" and "modified_by".
> Now I will try to reset signature=true and see what will happen. If it 
> causes the same error I could add but they will not managed automatically 
> by web2py, or I'm wrong?
> What do you suggest?
> Thank you for your precious information.
>
> Il giorno lunedì 17 agosto 2020 14:24:25 UTC+2, villas ha scritto:
>>
>> Hi Andrea
>> I was pleased to see you are making progress with the DB connection etc.
>> I can see why mssql does not like the cascade from the same auth_user 
>> table.  This may be an issue which needs fixing...
>> To get things moving, and this might not be ideal, but I propose you 
>> consider either of these options:
>>
>>1. Create manually your own tables without those contraints.  You 
>>then set this:  auth.define_tables(... migrate=False ) so that pyDal 
>>skips creation. 
>>2. Do not include the signature fields with your auth.  
>>auth.define_tables(... signature=False )
>>
>> Incidentally,  I use option 2 and I therefore do not benefit from the 
>> created and modified info,  but I could easily remedy this by adding the 
>> fields if I wished.
>> Hope this helps.
>>
>>

-- 
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/7e31b5d2-f56d-4508-b2ae-fc666d385beeo%40googlegroups.com.


[web2py] Re: DAL Could not create constraint or index

2020-08-18 Thread Andrea Fae'
Thank you Villas. I'm using option 2 and now I have the tables without 
"created_by" and "modified_by".
Now I will try to reset signature=true and see what will happen. If it 
causes the same error I could add but they will not managed automatically 
by web2py, or I'm wrong?
What do you suggest?
Thank you for your precious information.

Il giorno lunedì 17 agosto 2020 14:24:25 UTC+2, villas ha scritto:
>
> Hi Andrea
> I was pleased to see you are making progress with the DB connection etc.
> I can see why mssql does not like the cascade from the same auth_user 
> table.  This may be an issue which needs fixing...
> To get things moving, and this might not be ideal, but I propose you 
> consider either of these options:
>
>1. Create manually your own tables without those contraints.  You then 
>set this:  auth.define_tables(... migrate=False ) so that pyDal skips 
>creation. 
>2. Do not include the signature fields with your auth.  
>auth.define_tables(... signature=False )
>
> Incidentally,  I use option 2 and I therefore do not benefit from the 
> created and modified info,  but I could easily remedy this by adding the 
> fields if I wished.
> Hope this helps.
>
>

-- 
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/b08c2ba6-3847-4571-a3d3-27258637c1d9o%40googlegroups.com.


[web2py] Re: URI for mssql

2020-08-18 Thread Andrea Fae'
if you use mssql 2016 you maybe it's better to use this: 
mssql4://user:password@servername/databasename

I'm not specifying instance, and it seems working. Maybe I will try with 
the instance too.
thanks

Il giorno martedì 18 agosto 2020 07:18:06 UTC+2, T.R.Rajkumar ha scritto:
>
> I use the following.
> mssql2://user:pwd@servername\instance/databasename
> for connecting to mssql 2016
> I have my webserver apache and web2py running in windows8.
> mssql in windows 2016 server.
> In servername I use the IP of the machine.
> In instancename I have SQL16S7INS1   --- the instance name created by me 
> when installing mssql
> In databasename I have ocms_nlc   which is the database I have created 
> in mssql
> In username I give sa. You can give restricted username also if you have 
> created one and given permission for that user to the concerned database.
>
>
> On Sunday, August 16, 2020 at 3:24:18 PM UTC+5:30 and...@gmail.com wrote:
>
>> Is it correct this uri to connect to mssql server 2016?
>>
>> uri   = mssql4://user:password@servername\instance/databasename
>>
>> or
>>
>> uri   = mssql4://user:password@servername/databasename
>> (without instance)
>>
>> Do I have to use "/" for all separations or even "\"?
>>
>> how can I be sure to use pyodbc or pypyodbc?
>>
>> Thank you
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/03416bd6-9dfd-4592-be22-1f7e821c6c6fo%40googlegroups.com.


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

2020-08-18 Thread Kevin Keller
I see there is an open issue on git from 8 days ago:

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

So just FYI it is already reported.

Its a strange error.

Must be somewhere in the module save function and after save it should
trigger the compile which obviously does not work anymore either.

Should be a small thing

Am Di., 18. Aug. 2020 um 15:56 Uhr schrieb xgp.l...@gmail.com <
xgp.lat...@gmail.com>:

> Hi,
>
> I already open a conversation about this but no complete answers were
> given.
> I ran from source and experience the same error.
>
>
> Cheers,
>
> El Tuesday, August 18, 2020 a la(s) 8:52:43 AM UTC-5, kell...@gmail.com
> escribió:
>
>> Same issue here with newest web2py
>>
>> Am Di., 18. Aug. 2020 um 07:08 Uhr schrieb 'Annet' via web2py-users <
>> web...@googlegroups.com>:
>>
>>> I reported the same problem some time ago.
>>>
>>> When I edit a module and save it I get this nameError. Since I am
>>> importing the modules into other applications I have to restart web2py
>>> everytime I edit a module.
>>>
>>> Further more the module are no longer compiled on first use, which
>>> I also find very annoying.
>>>
>>> Annet
>>>
>>> Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:
>>>
 same error, though with a lot more than 3 lines

 On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com
 wrote:

>
> 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+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%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/df07ae0b-2ffa-453d-a481-363567f9b6f6n%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/CADHCKLQSg2MNzKE_OiVijJhJZDSG0z0qRtLxmT8%2BY%2Bq5Y4W0iA%40mail.gmail.com.


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

2020-08-18 Thread xgp.l...@gmail.com
Hi,

I already open a conversation about this but no complete answers were given.
I ran from source and experience the same error.


Cheers,

El Tuesday, August 18, 2020 a la(s) 8:52:43 AM UTC-5, kell...@gmail.com 
escribió:

> Same issue here with newest web2py
>
> Am Di., 18. Aug. 2020 um 07:08 Uhr schrieb 'Annet' via web2py-users <
> web...@googlegroups.com>:
>
>> I reported the same problem some time ago.
>>
>> When I edit a module and save it I get this nameError. Since I am
>> importing the modules into other applications I have to restart web2py
>> everytime I edit a module.
>>
>> Further more the module are no longer compiled on first use, which
>> I also find very annoying.
>>
>> Annet
>>
>> Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:
>>
>>> same error, though with a lot more than 3 lines
>>>
>>> On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com 
>>> wrote:
>>>

 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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%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/df07ae0b-2ffa-453d-a481-363567f9b6f6n%40googlegroups.com.


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

2020-08-18 Thread Kevin Keller
Same issue here with newest web2py

Am Di., 18. Aug. 2020 um 07:08 Uhr schrieb 'Annet' via web2py-users <
web2py@googlegroups.com>:

> I reported the same problem some time ago.
>
> When I edit a module and save it I get this nameError. Since I am
> importing the modules into other applications I have to restart web2py
> everytime I edit a module.
>
> Further more the module are no longer compiled on first use, which
> I also find very annoying.
>
> Annet
>
> Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:
>
>> same error, though with a lot more than 3 lines
>>
>> On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com
>> wrote:
>>
>>>
>>> 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/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%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/CADHCKLSUHiqMRLuuMYH%3DXvCqUAoXijcuu%2BT3v%3Dvt8bymn1huig%40mail.gmail.com.


[web2py] Re: How to improve a widget select list that allows new options to be added?

2020-08-18 Thread Clemens
Hi,

not sure, what kind of form you're using. Expecting you use SQLFORM, I 
solved this in similar case as follows:
form[0].insert(-1, TR(TD(LABEL(T('City')),
  TD(SELECT(_name='city', *[OPTION('{} 
{}'.format(city.code, city.name), _value=city.id)
 for city in db(db.city.id>0).select(db.city.ALL, 
orderby=city.code)], value=this_city.id)

this_city a preselected value and the one matching the record currently 
processed.

Since on reload (after submit) the db is requested again, the select list 
should be updated.

For further information on extra fields in an SQLFORM --> 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Adding-extra-form-elements-to-SQLFORM

Have a try, hope it helps!

Best regards
Clemens


On Tuesday, August 18, 2020 at 2:32:57 PM UTC+2 roge...@gmail.com wrote:

> Hi
>
> I want a drop down list that shows all the values from existing records 
> AND allows the user to add a new value if they want.
>
> I have got something working using https://select2.org/ . But my approach 
> is questionable.
>
> The problem i have is that when a new value is added and the form is 
> submitted, the widget code is called *before* the new value is persisted to 
> the database. So when the form reloads after successfully being processed, 
> the dropdown doesn't have the new item and so can't be displayed.
>
> If i then reload the page the new item is included and all is well.
>
> I got around this by delaying the creation of the Select2 dropdown. 
> Instead of the widget immediately building the Select2 it executes an AJAX 
> call which grabs the dropdown data and then builds it. Of course this is 
> done after the form has been accepted so it has the new entry and all works 
> well.
>
> Is this the best way to do it?
>
> Or can i somehow set the widget **after** the form has been created?
>
> Thanks
> Andrew
>

-- 
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/20a6a0d5-dec6-4fcc-a6d1-30421a7d2eadn%40googlegroups.com.


[web2py] How to improve a widget select list that allows new options to be added?

2020-08-18 Thread AGRogers
Hi

I want a drop down list that shows all the values from existing records AND
allows the user to add a new value if they want.

I have got something working using https://select2.org/ . But my approach
is questionable.

The problem i have is that when a new value is added and the form is
submitted, the widget code is called *before* the new value is persisted to
the database. So when the form reloads after successfully being processed,
the dropdown doesn't have the new item and so can't be displayed.

If i then reload the page the new item is included and all is well.

I got around this by delaying the creation of the Select2 dropdown. Instead
of the widget immediately building the Select2 it executes an AJAX call
which grabs the dropdown data and then builds it. Of course this is done
after the form has been accepted so it has the new entry and all works well.

Is this the best way to do it?

Or can i somehow set the widget **after** the form has been created?

Thanks
Andrew

-- 
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/CACWMBMNVeBd_cU5NSKRBSnyGVxcqDrDRf%2BLnC%3DOqmxshqG7Byg%40mail.gmail.com.


[web2py] Re: unicode symbols

2020-08-18 Thread Clemens
A(XML(''), ...)

On Tuesday, August 18, 2020 at 1:29:19 PM UTC+2 Dirk C wrote:

> Hello,
> I wonder if i can replace the string 'mytext' with a unicode symbol like 
> 
>
> {{=A('mytext',callback=URL(r=request,f='ltb_wijzig_groepssamenstelling'
> ,vars=dict(v_groepslid_id=groepslid.id
> ,v_dossier_id=dossier[0].id,v_ckz=dossier[0].f_ckz,v_naam=dossier[0].f_naam,v_action=
> "EDIT")))}}
>

-- 
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/298ef4cd-9c3a-4a6d-a0ae-8fff0560739dn%40googlegroups.com.


[web2py] unicode symbols

2020-08-18 Thread Dirk C
Hello,
I wonder if i can replace the string 'mytext' with a unicode symbol like 


{{=A('mytext',callback=URL(r=request,f='ltb_wijzig_groepssamenstelling'
,vars=dict(v_groepslid_id=groepslid.id,v_dossier_id=dossier[0].id,v_ckz=dossier[0].f_ckz,v_naam=dossier[0].f_naam,v_action=
"EDIT")))}}

-- 
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/cc1ccdb4-6f34-4128-8f09-5aacfea622adn%40googlegroups.com.


[web2py] Re: Nested menu item

2020-08-18 Thread 'Annet' via web2py-users
Hi,

I've got a two level menu, however, calling 

{{=MENU(response.app_menu)}}

doesn't render a Bootstrap 4 menu like your resulting html code. It
renders something pretty ugly:


  



  Our network
  Networks we joined
 
   
  
 


Do you have any idea how to solve this issue?

Kind regards,

Annet

Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:

> Missing something basic, but seems to me that the following code should 
> result in nested menu:
>
> response.menu = [['One', False, 'link1',
>   [
> ['Two', False, None,
>['Three', False, 'link3']
> ]
>   ]
>  ]
> ]
>
> "One" menu items contains "two", as it should, but "two" comes out to be a 
> simple menu item, not containing "three" in it. What's missing?? How do I 
> make nested sub-menu items? 
>
> Here is the resulting html, where "three" sub-item is not even present: 
>
> 
>  
> One
>  
>   Two
>  
> 
>
>
>
>
>

-- 
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/a268c377-cf99-4260-a337-6590eb9a271en%40googlegroups.com.