What I'm doing is pretty similar to the #extends thing actually. I'm doing this directly in the python code, though. I can extend the Cheetah-provided Template class in order to create both pure python and cheetah built-in functions. Additionally, because I can intercept Cheetah's compile function, I can actually replace SNIPPET:: even within snippets (so we can have recursive snippets without requiring the $SNIPPET syntax).
I think I may have also found a good way to carry over the #def's from snippets. (I tried #def global already. Cheetah barf, ew!). Basically, I can just append the search list of any snippets to the search list of the snippetter. Anyway, hopefully I'll have something working before Monday, and I'll have a patch ready. (I am moving back to school this weekend).
~
Dan
----------------------------------------
> Date: Wed, 30 Jul 2008 18:21:56 -0400
> From: mdehaan@redhat.com
> To: cobbler@lists.fedorahosted.org
> Subject: Re: Snippet with generalized functions
>
> Dan G wrote:
>> I ran into a huge roadblock today, I found out #include doesn't behave quite like SNIPPET (ignoring the per-system/profile stuff). If there are #defs inside the included file, they do not carry over into the including file. For instance:
>>
>> ------------my_template------------------
>> #include 'my_include'
>>
>> $my_func('foo')
>> ----------------------------------------------
>>
>> -----------my_include--------------------
>> #def my_func($a)
>> ${a}bar
>> #end def
>> ----------------------------------------------
>>
>
> There is a #set global that works for variables, that /may/ work for
> functions.
>
> #set global foo = 2
>
> They also have a mailing list here:
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
> The other trick is to do something like we do for CobblerWeb where we
> compile a master template that all Cheetah templates
> we use have access to. I'm not sure if that works, though it might.
> (#extends)
>
> http://www.cheetahtemplate.org/docs/users_guide_html_multipage/inheritanceEtc.extends.html
>
>
>
>> does not behave as expected. Changing "#include" to "SNIPPET::" yields the expected outcome.
>>
>> Lame.
>>
>> There is another problem I'm coming across that might actually be a bug in cheetah, so I probably will not have the other 'builtins' finished for some time.
>>
>>
>
> Yeah, definitely ask on the Cheetah ML. Or hop on IRC if you want, I
> wouldn't mind taking a look as well and may be some help. Maybe :)
>
>
>
>> I'll let you know as soon as I figure something out.
>>
>>
>
> Yep, no problem!
>
> --Michael
>
>
>
>> ~
>> Dan
>>
>>
>> ----------------------------------------
>>
>>> Date: Wed, 30 Jul 2008 11:02:37 -0400
>>> From: mdehaan@redhat.com
>>> To: cobbler@lists.fedorahosted.org
>>> Subject: Re: Snippet with generalized functions
>>>
>>> Aaron Lippold wrote:
>>>
>>>> Hay Mike,
>>>>
>>>> Dan is working with me on the generalization stuff for my project. I
>>>> still have to set him up with a cobbler server so he has been doing it
>>>> mostly on a Ubuntu box. I will get him going tomorrow with that. Where
>>>> is the link to the patch process again?
>>>>
>>>> Thanks,
>>>>
>>>> Aaron
>>>>
>>>>
>>> https://fedorahosted.org/cobbler/wiki/PatchProcess
>>>
>>>
>>>
>> _________________________________________________________________
>> Keep your kids safer online with Windows Live Family Safety.
>> http://www.windowslive.com/family_safety/overview.html?ocid=TXT_TAGLM_WL_family_safety_072008
>> _______________________________________________
>> cobbler mailing list
>> cobbler@lists.fedorahosted.org
>> https://fedorahosted.org/mailman/listinfo/cobbler
>>
>
> _______________________________________________
> cobbler mailing list
> cobbler@lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/cobbler
Keep your kids safer online with Windows Live Family Safety. Help protect your kids.