Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AD6E59FA59C for ; Tue, 10 Apr 2007 08:44:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72743-04 for ; Tue, 10 Apr 2007 08:44:15 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from h07.llord.com (unknown [195.140.142.194]) by postgresql.org (Postfix) with ESMTP id DE0FC9FA176 for ; Tue, 10 Apr 2007 08:44:15 -0300 (ADT) Received: from par69-8-88-161-102-87.fbx.proxad.net ([88.161.102.87] helo=apollo13) by h07.llord.com with esmtpa (Exim 4.63) (envelope-from ) id 1HbElk-0008CW-39 for pgsql-general@postgresql.org; Tue, 10 Apr 2007 13:44:16 +0200 Date: Tue, 10 Apr 2007 13:44:43 +0200 To: pgsql-general@postgresql.org Subject: Re: programmatic way to fetch latest release for a given major.minor version From: Listmail Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <1176155240.221125.319880@y80g2000hsf.googlegroups.com> <467669b30704091526v79ae044boe7217cc0777dce1f@mail.gmail.com> <5a0a9d6f0704091534i4e4af90co2dad0e9e0b60efee@mail.gmail.com> <461B3E6A.8080007@postgresql.org> <20070410081558.GB24976@svr2.hagander.net> <461B5064.8010004@postgresql.org> <20070410101852.GC24976@svr2.hagander.net> <461B6F10.3040800@postgresql.org> <20070410111509.GF24976@svr2.hagander.net> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <20070410111509.GF24976@svr2.hagander.net> User-Agent: Opera Mail/9.10 (Linux) X-PopBeforeSMTPSenders: junk@peufeu.com, lists@peufeu.com, peufeu@peufeu.com, pfcaillaud@peufeu.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - h07.llord.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - peufeu.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.483 tagged_above=0 required=5 tests=AWL=-0.293, BAYES_50=0.001, RCVD_IN_NJABL_SPAM=2.775 X-Spam-Level: ** X-Archive-Number: 200704/433 X-Sequence-Number: 112336 >> Yeah yeah, but terminology aside, having 2 or three digits in each >> attribute is just wrong! > > Terminology aside, why? The unit is "8.1" not "8" and "1". It makes no= > sense to say you're on version 8, in the given context, so why should = the > XML data pretend there is? > > //Magnus Just pretend that : - version =3D a tuple of integers (a, b, c, ...) - major =3D (a, b) - minor =3D (c, ...) Besides, that is sortable (unlike strings where 15 < 2) : latest minor for major : major, max(minor) where major =3D what you want <= int = value=3D"3" /> from BeautifulSoup import BeautifulSoup as Soup s =3D Soup("""""" ) >>> v =3D s.find('pgversion') >>> [int(x['value']) for x in v.find('major') ] [8, 2] >>> [int(x['value']) for x in v.find('minor') ] [3]