On Mar 2, 6:15 pm, "Ed Singleton" <[EMAIL PROTECTED]> wrote:
> On 3/2/07, Olli Wang <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi, is it possible to return content from controller rather than
> > "real" static file? Take my case. I have a test.txt file in /static/
> > and a expose method static, if I request 
> > urlhttp://localhost:8080/static/test.txt,
> > it returns "In file test.txt". But I do need the content returned from
> > controller, that is "In controller". Any idea?
>
> > # /path/to/static/test.txt
> > In file test.txt
>
> > # Controller.py
> > class Root(controllers.RootController):
> >     @expose()
> >     def static(name):
> >         return 'In controller'
>
> I don't think so, but it is trivial to get the same effect if you are
> using apache.  Just use mod_rewrite to redirect to a /special_static/
> controller.
>
> But why can't you do:
>
> # Controller.py
> class Root(controllers.RootController):
>     @expose()
>     def special_static(name):
>         return 'In controller'
>
> And when you want that file you link to /special_static/blah.txt
> instead of /static/blah.txt
>
> Ed

Because I need to replace something dynamically. I hope the url is the
same, but return my dynamical updated content. Actually, my expose
method open the same path static file first. I just hope to keep the
static files in the same path so I can maintain it easily.


--~--~---------~--~----~------------~-------~--~----~
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