2009/1/24 Mike Orr <[email protected]>:
>
> On Tue, Jan 13, 2009 at 4:12 PM, lasizoillo <[email protected]> wrote:
>> 2nd Idea:
>> In pylons, list() and view() are functions that response an html
>> content. You can call it, save result, and compose in other page. If
>> you want only some things you can refactor view() and list() in
>> sub-functions.
>
> What do you mean here?  Are you talking about actions named list and
> view?  REST controllers have view but not list (which is called
> index).  Or are you talking about something else?
>

list() and view() was actions in his mail.

Take a look to this silly example for a clear explanation:

---- 8< ------------

class PruebaController(BaseController):

    def index(self):
        return """
        <html>%s<body>Esto es el cuerpo %s</body></html>
        """ % (self.cabeza(), self.foot())

    def cabeza(self, title="Prueba"):
        return """
        <head><title>%s</title></head>
        """ % title

    def foot(self, msg="Made by lasi"):
        return """
        <span class="footer">%s</span
        """ % msg
---- 8< ------------

All actions methods are callable s URL. Index have sense called by
normal navigation, "cabeza" and "foot" can be called by ajax and
server calls. Its simple and works.

The example actions returns directly an string, but returning an
render("template.mako") works fine too.

Excuse me poor english that not allow me to explain more concisely.

Regards,

Javi

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

Reply via email to