Package: forgetsql
Version: 0.5.1-10
Severity: normal
Tags: patch upstream
Owner: Morten Werner Forsbring <[email protected]>
Hi,
this was sent to the [email protected] mailinglist. It should be
fixed for the package in Debian as well.
- Werner
Morten Brekkevold <[email protected]> writes:
> Hi all,
>
> forgetSQL is an unmaintained piece of shi^H^Hoftware that NAV versions
> up to 3.5 depend on. While we have removed this dependency from the
> coming NAV 3.6, some will experience warnings when running NAV under
> Python 2.5, and outright failures on Python 2.6, due to problems with
> the forgetSQL module.
>
> The forgetSQL module raises string exceptions in three places, and
> these are deprecated in Python 2.5, and not supported in 2.6. You may
> see error messages such as these:
>
> /var/lib/python-support/python2.5/forgetSQL.py:212: DeprecationWarning:
> raising a string exception is deprecated
> raise "NotFound"
>
> or
>
> File "/var/lib/python-support/python2.6/forgetSQL.py", line 212, in __new__
> raise "NotFound"
>
> TypeError: exceptions must be classes or instances, not str
>
>
> I'm attaching a quick forgetSQL patch I've written to overcome these
> problems until NAV 3.6 has reached a stable release.
--- forgetSQL.py.old 2010-02-24 11:55:01.000000000 +0100
+++ forgetSQL.py 2010-02-24 11:57:32.000000000 +0100
@@ -1,4 +1,4 @@
-
+#-*- coding: iso-8859-1 -*-
__version__ = "0.5.1"
## Distributed under LGPL
@@ -209,18 +209,18 @@
try: # to implement 'goto' in Python.. UGH
if not cls._cache.has_key(args):
# unknown
- raise "NotFound"
+ raise NotFound
(ref, updated) = cls._cache[args]
realObject = ref()
if realObject is None:
# No more real references to it, dead object
- raise "NotFound"
+ raise NotFound
age = time.time() - updated
if age > cls._timeout:
# Too old!
- raise "NotFound"
+ raise NotFound
updated = time.time()
- except "NotFound":
+ except NotFound:
# We'll need to create it
realObject = object.__new__(cls, *args)
ref = weakref.ref(realObject)