From: <no...@so...> - 2002-07-29 01:02:57
|
Patches item #569203, was opened at 2002-06-14 23:45 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=316528&aid=569203&group_id=16528 Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Ken Lalonde (kenlalonde) Assigned to: Gerhard Häring (ghaering) Summary: Add missing PgNumeric ops. Initial Comment: My app failed when evaluating -x, where x is a PgNumeric instance. This patch adds the __neg__ and __nonzero__ methods to PgNumeric (pypgsql-2.1): *** PgSQL.py 2002/06/13 22:53:17 1.1 --- PgSQL.py 2002/06/14 18:30:07 *************** *** 1070,1075 **** --- 1070,1081 ---- _o = other.__v return cmp(_s, _o) + def __neg__(self): + return PgNumeric(-self.__v, self.__p, self.__s) + + def __nonzero__(self): + return self.__v not in (None, 0) + def __add__(self, other): if self.__s < other.__s: _d = other.__s - self.__s ---------------------------------------------------------------------- >Comment By: Gerhard Häring (ghaering) Date: 2002-07-29 03:02 Message: Logged In: YES user_id=163326 Committed. Thanks. ---------------------------------------------------------------------- Comment By: Gerhard Häring (ghaering) Date: 2002-06-19 15:23 Message: Logged In: YES user_id=163326 Thanks, I'll look at it one of these days. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=316528&aid=569203&group_id=16528 |