WASystemConfiguration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

WASystemConfiguration

Ramiro Diaz Trepat-2
This is an easy one I guess.  Indeed it may be solved in a number of ways, I just wanted to ask what is the standard way.
I guess this is a standard set up issue to solve with WASystemConfiguration subclasses for anyone developing with Seaside.

If I have resources on a server, in a simple structure like:

/css
/img
/js

but for development I just use komanche and WAFileLibrary, which holds all resources in a single "virtual" path:

/file/LibraryName/resources


Then, in my root component I would like to have something like


RootComponent>>updateRoot: anHtmlRoot
    super updateRoot: anHtmlRoot.

    "in case i am in dev"
    anHtmlRoot stylesheet url: MyFileLibrary / #styleCss

   "in case i am in prod another path"



Should I try to get which subclass of WASystemConfiguration is installed and build the relative path inside #updateRoot:  ?
Or is there a different way to sort this out?

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WASystemConfiguration

Philippe Marschall
2009/10/1, Ramiro Diaz Trepat <[hidden email]>:

> This is an easy one I guess.  Indeed it may be solved in a number of ways, I
> just wanted to ask what is the standard way.I guess this is a standard set
> up issue to solve with WASystemConfiguration subclasses for anyone
> developing with Seaside.
>
> If I have resources on a server, in a simple structure like:
>
> /css
> /img
> /js
>
> but for development I just use komanche and WAFileLibrary, which holds all
> resources in a single "virtual" path:
>
> /file/LibraryName/resources
>
>
> Then, in my root component I would like to have something like
>
>
> RootComponent>>updateRoot: anHtmlRoot
>     super updateRoot: anHtmlRoot.
>
>     "in case i am in dev"
>     anHtmlRoot stylesheet url: MyFileLibrary / #styleCss

That's an uncool pattern. I know the tests use it everywhere but you
shouldn't use it. It's better to implement #selectorsToInclude in
MyFileLibrary and answer #(styleCss). The best way is probably to use
#resourceUrl: 'css/style.css'

> Should I try to get which subclass of WASystemConfiguration is installed and
> build the relative path inside #updateRoot:  ?
> Or is there a different way to sort this out?

There are multiple ways you can go. If you use Comanche I'd use
#resourceUrl: and a Comanche config to serve the files from disk.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WASystemConfiguration

Ramiro Diaz Trepat-2
Hi Philippe, thanks a lot for replying.
A couple of cuestions about your suggestion. If I understood right, you say:

First
Use #resourseUrl: in your #updateRoot: like:

anHtmlRoot stylesheet resourceUrl: 'css/style.css'

This sounds very good because you can change the resource base url either in a subclass of WASystemConfiguration or directly on the configuration of the website.
I have just tried this approach just now, and if the "Resource Base Url" entry field is not empty in the configuration it produces a walkback (MNU #addToPath:) in method:

WARenderContext>>absoluteUrlForResource:
right in the last line.  Because the url that was written on the configuration is basically a ByteString (which does not implement #addToPath:)

I guess this must be a bug in Seaside 3.0



Second
In development, serve files statically from the file system with Komanche, instead of WAFileLibrary I guess.
Do you have a code snippet to make Kom serve files from a certain path without disrupting Seaside?


Cheers

r



On Mon, Oct 5, 2009 at 8:54 PM, Philippe Marschall <[hidden email]> wrote:
2009/10/1, Ramiro Diaz Trepat <[hidden email]>:
> This is an easy one I guess.  Indeed it may be solved in a number of ways, I
> just wanted to ask what is the standard way.I guess this is a standard set
> up issue to solve with WASystemConfiguration subclasses for anyone
> developing with Seaside.
>
> If I have resources on a server, in a simple structure like:
>
> /css
> /img
> /js
>
> but for development I just use komanche and WAFileLibrary, which holds all
> resources in a single "virtual" path:
>
> /file/LibraryName/resources
>
>
> Then, in my root component I would like to have something like
>
>
> RootComponent>>updateRoot: anHtmlRoot
>     super updateRoot: anHtmlRoot.
>
>     "in case i am in dev"
>     anHtmlRoot stylesheet url: MyFileLibrary / #styleCss

That's an uncool pattern. I know the tests use it everywhere but you
shouldn't use it. It's better to implement #selectorsToInclude in
MyFileLibrary and answer #(styleCss). The best way is probably to use
#resourceUrl: 'css/style.css'

> Should I try to get which subclass of WASystemConfiguration is installed and
> build the relative path inside #updateRoot:  ?
> Or is there a different way to sort this out?

There are multiple ways you can go. If you use Comanche I'd use
#resourceUrl: and a Comanche config to serve the files from disk.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WASystemConfiguration

Julian Fitzell-2
On Tue, Oct 6, 2009 at 12:38 AM, Ramiro Diaz Trepat
<[hidden email]> wrote:
> I have just tried this approach just now, and if the "Resource Base Url"
> entry field is not empty in the configuration it produces a walkback (MNU
> #addToPath:) in method:
> WARenderContext>>absoluteUrlForResource:
> right in the last line.  Because the url that was written on the
> configuration is basically a ByteString (which does not implement
> #addToPath:)
> I guess this must be a bug in Seaside 3.0

Indeed it is. Thanks.

http://code.google.com/p/seaside/issues/detail?id=483

Julian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside