[Grok-dev] Bug in JSON view?

Sebastian Wiemer sebastian.wiemer at gmail.com
Tue Jan 13 12:13:22 EST 2009


Hello,

is this a bug in grok.JSON?

I wrote a class and a JSONAdapter for that class.
But the function "delete(self, key)" does not work, because
the last to letters of the string value of "key" is somehow  
"overwritten" with the letters "Pr".
So the key 1234abc yields 1234aPr


------------------------------------------------------------------------------------------------------------------------------
import grok

class App(grok.Application, grok.Container):
    pass

# the adapter for the jason functions
class JSONAdapter(grok.JSON):
     grok.context(Tm2p)

# ... stuff deleted

     def deleteItem(self, key): # <-- the key ALWAYS ends with "Pr"  
instead of the last two letters
         if self.context.has_key(key):
             del self.context[key]
             return "Deleted ", key
         return "not deleted"

class Index(grok.View):
     pass # see app_templates/index.pt

------------------------------------------------------------------------------------------------------------------------------

Please help, it is so frustrating...

Sebastian


More information about the Grok-dev mailing list