From commits-return-11599-apmail-qpid-commits-archive=qpid.apache.org@qpid.apache.org Mon Dec 28 12:44:15 2009 Return-Path: Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: (qmail 87741 invoked from network); 28 Dec 2009 12:44:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Dec 2009 12:44:15 -0000 Received: (qmail 42090 invoked by uid 500); 28 Dec 2009 12:44:15 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 42063 invoked by uid 500); 28 Dec 2009 12:44:14 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 42054 invoked by uid 99); 28 Dec 2009 12:44:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Dec 2009 12:44:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Dec 2009 12:44:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5A5B223888E7; Mon, 28 Dec 2009 12:43:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r894161 - in /qpid/branches/qpid.rnr/python/qpid: address.py tests/address.py Date: Mon, 28 Dec 2009 12:43:51 -0000 To: commits@qpid.apache.org From: rhs@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091228124351.5A5B223888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhs Date: Mon Dec 28 12:43:50 2009 New Revision: 894161 URL: http://svn.apache.org/viewvc?rev=894161&view=rev Log: allow any value as a map key Modified: qpid/branches/qpid.rnr/python/qpid/address.py qpid/branches/qpid.rnr/python/qpid/tests/address.py Modified: qpid/branches/qpid.rnr/python/qpid/address.py URL: http://svn.apache.org/viewvc/qpid/branches/qpid.rnr/python/qpid/address.py?rev=894161&r1=894160&r2=894161&view=diff ============================================================================== --- qpid/branches/qpid.rnr/python/qpid/address.py (original) +++ qpid/branches/qpid.rnr/python/qpid/address.py Mon Dec 28 12:43:50 2009 @@ -102,8 +102,8 @@ result = {} while True: - if self.matches(ID): - n, v = self.nameval() + if self.matches(NUMBER, STRING, ID, LBRACE, LBRACK): + n, v = self.keyval() result[n] = v if self.matches(COMMA): self.eat(COMMA) @@ -114,16 +114,17 @@ elif self.matches(RBRACE): break else: - raise ParseError(self.next(), ID, RBRACE) + raise ParseError(self.next(), NUMBER, STRING, ID, LBRACE, LBRACK, + RBRACE) self.eat(RBRACE) return result - def nameval(self): - name = self.eat(ID).value + def keyval(self): + key = self.value() self.eat(COLON) val = self.value() - return (name, val) + return (key, val) def value(self): if self.matches(NUMBER, STRING, ID): Modified: qpid/branches/qpid.rnr/python/qpid/tests/address.py URL: http://svn.apache.org/viewvc/qpid/branches/qpid.rnr/python/qpid/tests/address.py?rev=894161&r1=894160&r2=894161&view=diff ============================================================================== --- qpid/branches/qpid.rnr/python/qpid/tests/address.py (original) +++ qpid/branches/qpid.rnr/python/qpid/tests/address.py Mon Dec 28 12:43:50 2009 @@ -136,12 +136,13 @@ def testBadOptions1(self): self.invalid("name/subject; {", - "expecting (ID, RBRACE), got EOF line:1,15:name/subject; {") + "expecting (NUMBER, STRING, ID, LBRACE, LBRACK, RBRACE), " + "got EOF line:1,15:name/subject; {") def testBadOptions2(self): self.invalid("name/subject; { 3", - "expecting (ID, RBRACE), got NUMBER('3') " - "line:1,16:name/subject; { 3") + "expecting COLON, got EOF " + "line:1,17:name/subject; { 3") def testBadOptions3(self): self.invalid("name/subject; { key:", @@ -160,7 +161,7 @@ def testBadOptions6(self): self.invalid("name/subject; { key: value,", - "expecting (ID, RBRACE), got EOF " + "expecting (NUMBER, STRING, ID, LBRACE, LBRACK, RBRACE), got EOF " "line:1,27:name/subject; { key: value,") def testBadOptions7(self): @@ -197,3 +198,14 @@ def testBadList4(self): self.invalid("name/subject; { key: [ 1 2 ] }", "expecting (COMMA, RBRACK), " "got NUMBER('2') line:1,25:name/subject; { key: [ 1 2 ] }") + + def testMap1(self): + self.valid("name/subject; { 'key': value }", + "name", "subject", {"key": "value"}) + + def testMap2(self): + self.valid("name/subject; { 1: value }", "name", "subject", {1: "value"}) + + def testMap3(self): + self.valid('name/subject; { "foo.bar": value }', + "name", "subject", {"foo.bar": "value"}) --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org