Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance
Hello all, On Fri, 2011-06-17 at 21:59 +0530, Joshua Immanuel wrote: Ok, let me give an use-case. Say, I have a base page layout template for the inner sites like http://localhost:/site1; which has many application related menu links on the top and left hand side of the page with center space for contents. All these links are of the format /container1/ When I use virtual hosting to '/site1' I have no problem, all the links will be a valid one, as it will be prefixed by http://localhost:/site1; But, If I don't use virtual hosting and I expose http://localhost:/; URL to the user to create new sites. The links in base page layout template for the inner sites will be an invalid one as it will be pointing to http://localhost:/container1/..; instead of http://localhost:/site1/container1/..; I am trying to figure out how to prefix the links in the base page layout template with site names based on which site they belong. So that the links in the base page layout template of 'site1' would be of the format '/site1/container1/.. and the links in base page layout template of 'site2' would be of the format '/site2/container1/.. etc. I guess the solution to this (without virtual hosting) would be: when I render the base page layout template for http://localhost:/site1; get the 'site1' part from the request URL and prefix all the related menu links with them. Is there any other better solution? But, If I use this base page layout template as a macro (just to fill its center content with an add form say) still the menu links has to be a valid one. How to handle this? I used the following code in the base page layout template to get the site name from the URL body tal:define= rootURL request/getApplicationURL; fullURL request/getURL; effURL python: fullURL[len(rootURL)+1:].split('/'); span tal:condition=python: len(effURL) 1 span tal:define=global urlPrefix python: effURL[0] tal:replace=nothing/ /span span tal:condition=python: len(effURL) = 1 span tal:define=global urlPrefix python: '' tal:replace=nothing/ /span ... /body I prefix all my menu links with the 'urlPrefix' variable. I guess this is not the best solution but it solves my problem. Thanks -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance
Hello Thierry, Thanks for the reply. On Fri, 2011-06-17 at 14:31 +0200, Thierry Florac wrote: I guess you just want to do virtual hosting inside a single BlueBream application server Ok. That is one way to say. What if I want to add new sites dynamically from the web frontend? For the virtual hosting, I don't have to care about the URL prefix, I just treat my URLs as say, /container1/object1/@@add.html instead of /site1/container1/object1/@@add.html. But say, I have a view page for http://localhost:/; (i.e. for zope.site.interfaces.IRootFolder) which has links to create new sites. And say, I create necessary application specific objects under them when the new site is added to the root. How to dynamically handle the URLs for this kind of situation? -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance
Hello, Sorry to bother again. On Fri, 2011-06-17 at 16:47 +0200, Thierry Florac wrote: Sorry but I'm not really sure to understand what you want or need... The physical path of your folder inside your ZODB is '/site1/container1/...' and to access such a site you only have two ways to do it : - address it directly in the URL - or use virtual hosting to hide '/site1' from the URL Ok, let me give an use-case. Say, I have a base page layout template for the inner sites like http://localhost:/site1; which has many application related menu links on the top and left hand side of the page with center space for contents. All these links are of the format /container1/ When I use virtual hosting to '/site1' I have no problem, all the links will be a valid one, as it will be prefixed by http://localhost:/site1; But, If I don't use virtual hosting and I expose http://localhost:/; URL to the user to create new sites. The links in base page layout template for the inner sites will be an invalid one as it will be pointing to http://localhost:/container1/..; instead of http://localhost:/site1/container1/..; I am trying to figure out how to prefix the links in the base page layout template with site names based on which site they belong. So that the links in the base page layout template of 'site1' would be of the format '/site1/container1/.. and the links in base page layout template of 'site2' would be of the format '/site2/container1/.. etc. I guess the solution to this (without virtual hosting) would be: when I render the base page layout template for http://localhost:/site1; get the 'site1' part from the request URL and prefix all the related menu links with them. Is there any other better solution? But, If I use this base page layout template as a macro (just to fill its center content with an add form say) still the menu links has to be a valid one. How to handle this? Hope I clarified what I need. Please excuse me if my question sounds too novice. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance
Hello Thierry, On Fri, 2011-06-17 at 19:28 +0200, Thierry Florac wrote: I suppose that you could write your own IAbsoluteURL adapter ;-) Alternatively, for a given context, you can probably try to find it's parent site (« site1 », via getParents() traversing method), get it's URL and concatenate it with your actual absolute URLs... I'll try out and get back. Thanks for answering my queries patiently. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )