From: <no...@so...> - 2002-06-14 21:45:17
|
Patches item #569203, was opened at 2002-06-14 17:45 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=316528&aid=569203&group_id=16528 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Ken Lalonde (kenlalonde) Assigned to: Nobody/Anonymous (nobody) 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 ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=316528&aid=569203&group_id=16528 |