Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 545

Show
Ignore:
Timestamp:
08/21/05 15:21:29
Author:
fumanchu
Message:

Server-side image maps (ISMAP) now supported. Coordinates are coerced to int and passed as 'x' and 'y'.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cphttptools.py

    r531 r545  
    330330         
    331331        # build a paramMap dictionary from queryString 
    332         pm = cgi.parse_qs(req.queryString, keep_blank_values=True) 
    333         for key, val in pm.items(): 
    334             if len(val) == 1: 
    335                 pm[key] = val[0] 
     332        if re.match(r"[0-9]+,[0-9]+", req.queryString): 
     333            # Server-side image map. Map the coords to 'x' and 'y' 
     334            # (like CGI::Request does). 
     335            pm = req.queryString.split(",") 
     336            pm = {'x': int(pm[0]), 'y': int(pm[1])} 
     337        else: 
     338            pm = cgi.parse_qs(req.queryString, keep_blank_values=True) 
     339            for key, val in pm.items(): 
     340                if len(val) == 1: 
     341                    pm[key] = val[0] 
    336342        req.paramMap = pm 
    337343         
  • trunk/cherrypy/test/test_core.py

    r534 r545  
    6363    def index(self, thing): 
    6464        return thing 
     65     
     66    def ismap(self, x, y): 
     67        return "Coordinates: %s, %s" % (x, y) 
    6568 
    6669 
     
    284287        self.getPage("/params/?thing=a&thing=b&thing=c") 
    285288        self.assertBody('abc') 
     289         
     290        # Test coordinates sent by <img ismap> 
     291        self.getPage("/params/ismap?223,114") 
     292        self.assertBody("Coordinates: 223, 114") 
    286293     
    287294    def testStatus(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets