backward compatibility

2 views
Skip to first unread message

Renato-ES-Brazil

unread,
Oct 26, 2009, 11:37:22 AM10/26/09
to web2py-users
Massimo,

About the question of "backward compatibility", maybe there will come
a time that one of the principles Python and web2py are broken,
specifically this: "There should be only one way of doing things".

Or not? :-)

Example (extracted from manual):

"For backward compatibility SQLDB=DAL and SQLField=Field. We encourage
you to use the new syntax DAL and Field, instead of the old syntax."

I think would be interesting display warnings in some log file about
the deprecated methods used in some app. What do you think? Is web2py
already capable of doing that?

Thanks. :-)

mdipierro

unread,
Oct 26, 2009, 11:42:27 AM10/26/09
to web2py-users
Good point. web2py can do this

import logging
logging.warn('something is deprecated')

I could redefine

SQLDB=lambda *a,**b: logging.warn(...) and DAL(*a,**b)

this would already produce lots of logs. I would not do it for SQLXyy
because that would make even more logs.

Pros/Cons?

On Oct 26, 10:37 am, Renato-ES-Brazil <caliari.ren...@gmail.com>
wrote:

Álvaro Justen [Turicas]

unread,
Oct 26, 2009, 12:14:46 PM10/26/09
to web...@googlegroups.com
On Mon, Oct 26, 2009 at 13:42, mdipierro <mdip...@cs.depaul.edu> wrote:
>
> Good point. web2py can do this
>
> import logging
> logging.warn('something is deprecated')
>
> I could redefine
>
>   SQLDB=lambda *a,**b: logging.warn(...) and DAL(*a,**b)
>
> this would already produce lots of logs. I would not do it for SQLXyy
> because that would make even more logs.

I agree.

> Pros/Cons?
>
> On Oct 26, 10:37 am, Renato-ES-Brazil <caliari.ren...@gmail.com>
> wrote:
>> Massimo,
>>
>> About the question of "backward compatibility", maybe there will come
>> a time that one of the principles Python and web2py are broken,
>> specifically this: "There should be only one way of doing things".
>>
>> Or not? :-)
>>
>> Example (extracted from manual):
>>
>> "For backward compatibility SQLDB=DAL and SQLField=Field. We encourage
>> you to use the new syntax DAL and Field, instead of the old syntax."
>>
>> I think would be interesting display warnings in some log file about
>> the deprecated methods used in some app. What do you think? Is web2py
>> already capable of doing that?
>>
>> Thanks. :-)
> >
>



--
Álvaro Justen
Peta5 - Nós fazemos TV Digital!
21 3021-6001 / 9898-0141
http://www.peta5.com.br/

Renato-ES-Brazil

unread,
Oct 27, 2009, 12:00:27 PM10/27/09
to web2py-users
I think that something needs to be doing to keep the principle ("There
should be only one way of doing things").
Some warnings would be a good start. :-)

On 26 out, 14:14, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
wrote:

Thadeus Burgess

unread,
Oct 27, 2009, 12:15:11 PM10/27/09
to web...@googlegroups.com
I suggest a gluon/deprecated.py. This file would hold all deprecated functions/classes. In say your configuation file, say options_std.py you could set what version of web2py to run under, and if the version is less that what the version currently is, it will grab and replace the appropriate functions/classes with the ones in deprecated.py

-Thadeus

mdipierro

unread,
Oct 27, 2009, 12:18:32 PM10/27/09
to web2py-users
I do not think this feasible.

On Oct 27, 11:15 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> I suggest a gluon/deprecated.py. This file would hold all deprecated
> functions/classes. In say your configuation file, say options_std.py you
> could set what version of web2py to run under, and if the version is less
> that what the version currently is, it will grab and replace the appropriate
> functions/classes with the ones in deprecated.py
>
> -Thadeus
>
> On Tue, Oct 27, 2009 at 11:00 AM, Renato-ES-Brazil <caliari.ren...@gmail.com

Thadeus Burgess

unread,
Oct 27, 2009, 12:24:19 PM10/27/09
to web...@googlegroups.com
I agree :P Worth a shot though haha

-Thadeus
Reply all
Reply to author
Forward
0 new messages