You don't need save the converted value (if the cpu's clicles are not
important). You can add a property into your mapper object at the
model.
http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_properties_overriding

You can can read value.b (from b col in database) or value.b_toHtml
(whith an automatic conversion from database).

¿Why this is better than a custom view function?

Because if in the future the cpu cicles would import. You can create a
precalculated b_toHtml col in the database (filled automaticaly by a
setter b col in the mapper). Whith a minimal change, you get a
pregenerated html from textile. You read the html more times than you
update your textile data.

If you can do a custom view function yet:
http://docs.turbogears.org/1.0/stdvars
(Custom additions)

Excuse my poor english.

Reggars:

Javi

2007/7/4, Paul Johnston <[EMAIL PROTECTED]>:
>
> Hi,
>
> >that is generally a bad idea, you are mixing presentation logic with
> >bussiness logic, why can't you just define the function and pass it's
> >results as a variable? is x something defined in runtime inside the
> >template? do you have access to X before if so then the first approach
> >I suggested is the way to go, if not please post an example of what
> >your actually trying to do.
> >
> >
> Ah, interesting comment.
>
> What myfunc does is run textile (simple markup to html) on the input,
> plus a few of my own tweaks. I am then using it on some fields that are
> being displayed in the widget, something like:
>
> <td>$value.a</td><td>${mytextile(value.b)}</td>
>
> The value is an SQLAlchemy object, so I don't want to update the values
> (as that would get saved in the database) and I'd like to avoid creating
> a copy of the object. So, doing the calls at this point seems sensible.
>
> I guess this is something of a special case.
>
> Paul
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to