Hm, can this be done by modifying the data dictionary?  I think that
was my original suggestion.  Like:

def AddPathInfo(data_dict):
  for each compound object:
    AddPathInfo(...) # recursively

def expand_with_path_info(self, data_dict):
  self.expand(AddPathInfo(data_dict))

Actually the other bug about Template not being prototypable is
relevant here.  I think this would fit well in an add-on module, and I
was thinking about adding it but never got around to it.  There are a
few things like this that you might want to do with the data
dictionary.

Andy


On Wed, May 20, 2009 at 1:22 PM, Martijn Faassen <[email protected]> wrote:
>
> Hey there,
>
> I've hacked around in json-template.js to see whether I could add
> these hooks. Here is my attempt:
>
> http://codereview.appspot.com/63124/show
>
> (I hope I used codereview correctly)
>
> Sketching out my changes:
>
> * modifications of _ScopedContext to track name. Modification to
> construct the path.
>
> * BeforeSection and BeforeRepeatedSection hooks that can be passed
> along with Template options. These are functions that take the context
> and the callback as arguments. callback can then be used to insert
> text into the result stream. (perhaps they should be called
> before_section and before_repeated_section?)
>
> I got the v8-based tests running, and the javascript tests still pass
> with my modifications.
>
> I experimented a bit with javascript/verifier.py to try passing along
> the BeforeSection and BeforeRepeatedSection that print the path. This
> seems to work at least in some cases, but of course all the tests
> break.
>
> Any ideas on how I can modify the tests so I can pass along javascript
> functions as options? I guess this would be a javascript only test (if
> I adjust the Python source I'd need different hook functions), and I
> saw a @testy.only_verify that can help, but I'm not quite sure how to
> even pass this options information in properly from
> jsontemplate_test.py...
>
> Regards,
>
> Martijn
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to