[web2py] How to debug "lost password"

2020-08-19 Thread Jon Subscripted
Hi everyone,
I'm having some trouble sending "lost password" emails to my users.
Whenever I test it I get an "Unable to send email" message.

But I do not really know the reason. I tried with a standalone python
script with the same configuration and it works.

I'd like to know how to debug this problem or where to look at.

In which log are email related errors written?
Regards, Jon.

-- 
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/CAK8tz30UFKkg4h%2BLLiM3CuiFhekcfO%3D0teUt2V_8JQ_nA8bt1w%40mail.gmail.com.


[web2py] Re: Error with FDB in new version of Web2py

2020-08-19 Thread Константин Комков
*Massimo, Villas* I checked last update in firebird.py at 15 May, but it's 
not work. That file is not work with any firebird database.

-- 
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/0e112cc7-798c-477f-a850-b2208c8cc88ao%40googlegroups.com.


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

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

Looking for the solution to this matter also.

File "web2py/gluon/custom_import.py", line 109, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level) 

Files are placed in the modules folder.


Regards,

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/2bde98e7-307e-4645-82bd-2f415d4f0a8cn%40googlegroups.com.


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

2020-08-19 Thread villas
*An easier solution for you could be this!*
Simply specify your created_by/modified_by as extra fields (which should 
side-step self-referencing probem).
I didn't test it, but it seems like a good idea to me. You can then use 
normal migrations etc.

auth.settings.extra_fields['auth_user']= [

 Field('is_active', 'boolean', default=True),
 Field('created_on', 'datetime', default=request.now),
 Field('created_by', 'integer', default=auth.user_id),
 Field('modified_on', 'datetime', update=request.now),
 Field('modified_by', 'integer', update=auth.user_id)

]

auth.define_tables(... signature=False )

*Otherwise, in answer to your questions...*
migrate='asset_archive.table'
Personally, I do not specify the table definition name as the one given 
automatically by web2py is very good.  I just use migrate=True/False.
If you use migrate='asset_archive.table',  you are also specifying 
migrate=True

fake_migrate=True
This is used to recreate the .table file without touching your DB.
If you manually create and edit the fields in your DB,  you may wish to 
recreate the .table definition file (hence fake_migrate).

I am not sure how you are using the archiving etc,  but I do know this:  

   - you can manually create your own DB on-disk structure with whatever 
   triggers, indexes etc you require.
   - in web2py you can use define_table to create a web2py meta definition 
   (which must be compatible with what is on disk!)
   - you can use fake_migrate if you wish to create a .table definition 
   file (which will reflect your web2py define_table)
   - you can use migrate=False to prevent web2py from attempting to migrate 
   the physical DB on-disk structure

Using the above, the book explanation should make a little more sense.  







On Wednesday, 19 August 2020 09:43:42 UTC+1, Andrea Fae' wrote:

> Hello Villas, unfortunately other problems to this game...
> I used archiving, and so this type of table definitions
>
> db.define_table('asset_archive',
> Field('current_record', db.asset),
> db.asset,migrate='asset_archive.table')
>
> but I have the same problem regarding FOREIGN KEYS...no way to recreate 
> the tables.
>
> Do I have to give up the record archiving? Waht do you think?
>
> If you can, please can you explain the meaning of fake_migrate? I never 
> used and in the book is not very well explained. 
>
> Thank you
>
>
>
> Il giorno martedì 18 agosto 2020 22:38:50 UTC+2, villas ha scritto:
>>
>> 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 

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

2020-08-19 Thread Andrea Fae'
Hello Villas, unfortunately other problems to this game...
I used archiving, and so this type of table definitions

db.define_table('asset_archive',
Field('current_record', db.asset),
db.asset,migrate='asset_archive.table')

but I have the same problem regarding FOREIGN KEYS...no way to recreate the 
tables.

Do I have to give up the record archiving? Waht do you think?

If you can, please can you explain the meaning of fake_migrate? I never 
used and in the book is not very well explained. 

Thank you



Il giorno martedì 18 agosto 2020 22:38:50 UTC+2, villas ha scritto:
>
> 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/6abf4f78-8ed7-4332-8ba4-621f897b7dd9o%40googlegroups.com.


Re: [web2py] Re: Reloading modules

2020-08-19 Thread Andrew Rogers
This is an old post. But I had this problem too. 'track_changes' works fine 
in a brand new project. But i can't get it to work in my now quite large 
project. 

Eventually I found something that works. My module is called 'public.py' 
and it lives where it should - in the 'web2py/applications/myapp/modules' 
folder.  I include the following at the top of the db.py file in the 
'models' folder.

import importlib
import sys
importlib.reload(sys.modules['public'])

I am  not sure what the proper approach is to develop using modules. I have 
a lot of code in the models folder currently. However everything i have 
read says 'dont put too much stuff in the models folder' and 'dont reload 
modules'.

I know i shouldn't reload modules when in production. But it would be 
unpleasant to develop code in modules if i had to restart the server 
everything each time i made a change. If anyone has any thoughts on the 
right way to do this i would be love to hear them.

Cheers
Andrew
On Friday, 11 May 2012 at 02:25:34 UTC+10 howesc wrote:

> yes, sorry, i meant in development time.
>
> in one project i moved models to modules and shaved about 33% off of the 
> GAE production request time. another project is in test this week and i 
> will hopefully have numbers soon. note that when you don't need auth 
> (not all of my requests use auth) not setting it up saves about 200ms on 
> GAE.
>
> cfh
>
> On 5/10/12 9:21 , Alex BENFICA wrote:
> > Hi...
> >
> > When you say "now that i'm doing more and more in modules it does slow
> > things down"... are you talking about development time, right? is not
> > about the performace of you web2py app... is that?
> >
> > The performance increase when using modules instead put code on models
> > worth all this extra work?
> > Do you have any measure about this performance gain?
> >
> >
> > On Thu, May 10, 2012 at 1:17 PM, howesc wrote:
> >> i use the persistent local datastore on GAE SDK as well. i have not 
> tried
> >> to turn on dynamic module re-loading on GAE, but i have a shell script 
> that
> >> starts/stops GAE and i just restart that. it's not as fast as
> >> auto-reloading but it has been ok for me (though now that i'm doing 
> more and
> >> more in modules it does slow things down)
> >>
> >>
> >> On Wednesday, May 9, 2012 2:27:33 PM UTC-7, Alex Benfica wrote:
> >>>
> >>> Oi Ricardo,
> >>>
> >>> Thanks.
> >>>
> >>> I add the option to use sql lite and databse keeps data when I restart
> >>> app engine SDK.
> >>> And about the module reloading... did you have any problems with it?
> >>>
> >>> On Wed, May 9, 2012 at 5:54 PM, Ricardo Pedroso
> >>> wrote:
>  On Wed, May 9, 2012 at 8:35 PM, Alex Benfica
>  wrote:
> >
> > I'm having a seriuos problem having to stop and start Google App 
> Engine
> > SDK
> > when I want edit modules, otherwise, they are not reloaded.
> > The problem is that, doing this, I lose the entire database content 
> on
> > GAE
> > SDK...
> 
>  You can persist the data on GAE SDK
> 
> 
>  
> https://developers.google.com/appengine/docs/python/tools/devserver#Using_the_Datastore
> 
>  Ricardo
> >>>
> >>>
> >>>
> >>> --
> >>> --
> >>>
> >>> Atenciosamente,
> >>> Alex BENFICA
> >>>
> >>> --
> >>> "O que n�o se mede n�o se gerencia."
> >
> >
> >
>

-- 
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/59dd33cf-e67c-4617-a463-32613f48c8e8n%40googlegroups.com.