[Grok-dev] Using static resources from a sub-package?
elsku.magga at gmail.com
Thu Apr 7 10:38:36 EDT 2011
On Apr 6, 11:55 pm, Jan-Jaap Driessen <jdries... at thehealthagency.com>
> On 30 March 2011 21:08, Magga <elsku.ma... at gmail.com> wrote:
> > Hi guys, are people generally not sub-packaging the src folder? It is
> > handy in bigger projects.
> > Cheers,
> > Magga
> > On Mar 17, 5:06 pm, Kevin Teague <ke... at bud.ca> wrote:
> >> Using Grok 1.3 with the new fanstatic package, it doesn't seem like
> >> the static directory can be accessed if the View is contained within a
> >> sub-package of the main application package.
> >> For example, given 'testproject' with this layout:
> >> ./src/testproject/app.py
> >> ./src/testproject/app_templates/index.pt
> >> ./src/testproject/pages/thing.py
> >> ./src/testproject/pages/thing_templates/thing.pt
> >> Then the template in app_templates has no problem using something like
> >> the example link to a static directory:
> >> <img tal:attributes="src static/evencaveman.jpg"/>
> >> Move this line into the thing.pt template in a sub-package though, and
> >> the static variable for the View is being set to None. And things
> >> break :(
> >> So this seems like a bug to me ... unless sub-packages are not being
> >> supported or something else? Anyone else noticed this?
> >> _______________________________________________
> >> Grok-dev mailing list
> >> Grok-... at zope.orghttps://mail.zope.org/mailman/listinfo/grok-dev
> > _______________________________________________
> > Grok-dev mailing list
> > Grok-... at zope.org
> Hi Magga,
> In our projects we put all browser views in the subdir `browser`, REST
> views in the subdir `rest` and so on. Grok and fanstatic do not stand
> in the way of sub-packaging your application.
> The `static` syntax is useful for people getting started with grok,
> consider using `context/++resource++$your_app_name` as described
> Jan-Jaap Driessen
> Grok-dev mailing list
> Grok-... at zope.orghttps://mail.zope.org/mailman/listinfo/grok-dev
Thank you Jan-Jaap, your advice was good, now I see my images :).
More information about the Grok-dev