get ride of /website/root

23 views
Skip to first unread message

Kaeshi Wasa

unread,
Jun 10, 2014, 4:23:25 PM6/10/14
to nive...@googlegroups.com
Hi,

I come back...

Is it possible to get rid of /website/root ?
For example
http://lassoduvelo.org/randonnees.html instead of http://lassoduvelo.org/website/root/randonnees.html

Thanks

Arndt Droullier

unread,
Jun 12, 2014, 6:45:37 AM6/12/14
to nive...@googlegroups.com

Hi,

I thought about the same thing some time ago and just had a look again. Right now it doesn't work though the solution might be

--
You received this message because you are subscribed to the Google Groups "nive-cms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nive-cms+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arndt Droullier

unread,
Jun 12, 2014, 6:57:39 AM6/12/14
to nive...@googlegroups.com
Hi,

ah, sorry for the previous mail, text formatting went wrong.

I thought about the same thing some time ago and just had a look again. Right now it doesn't work though the solution might be
quite easy. 

To make the pages to be found without "website/root" in the url the following Portal class works:


class DefaultWebsitePortal(Portal):

    def __getitem__(self, name):
        try:
            # the default behaviour
            return super(DefaultWebsitePortal, self).__getitem__(name)
        except KeyError:
            pass
        # if name not found load the website and root and try to lookup
        # a cms page by name
        website = self["website"]
        try:
            return website[name]
        except KeyError:
            pass
        root = website.root()
        return root[name]


The unsolved problem is that the generated urls still include "website/root". I'm not quite sure but I think
there is a pyramid option to handle 'virtual urls'. Maybe this works. I haven't had a look at it yet. 
If it doesn't the pyramid resource_url function has to be replaced. 

Have you used virtual urls in pyramid?

Arndt.

Kaeshi Wasa

unread,
Jun 15, 2014, 3:24:31 AM6/15/14
to nive...@googlegroups.com
Hi,

About virtual urls, you mean this :  http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/vhosting.html?highlight=http_x_vhm_root
Then, it works and doesn't need to override Portal. But i have to take care of userdb, and editor. My nginx config look like that :

location / {

    try_files /maintenance.html $uri $uri/index.html @velonive;
}
location ~ /(userdb|logout|website/editor) {
    try_files /maintenance.html $uri $uri/index.html @velonive_admin;

}

location @velonive_admin {
    proxy_pass http://localhost:65075;
}
location @velonive {
    proxy_pass http://localhost:65075;
    proxy_set_header X_VHM_ROOT /website/root/;
    proxy_set_header HOST velonive.riol;
}


Kaeshi Wasa

unread,
Jun 15, 2014, 4:33:18 AM6/15/14
to nive...@googlegroups.com
I've just a problem with the root url :

in the template : ${view.PageUrl(context.root())}
resource_url return the name of the site
: http://lassoduvelo.org/

in PageUrl :
        if hasattr(page, "extension"):
            return u"%s.%s" % (resource_url(page, self.request)[:-1], page.extension)

return http://lassoduvelo.org.html

Do you have an idea ?

Arndt Droullier

unread,
Jul 7, 2014, 12:16:25 PM7/7/14
to nive...@googlegroups.com
Hi,
if you already have a customized copy of the template you could try to change the method to 

${view.FolderUrl(context.root())}

This will skip the 'html' extension. 

Arndt


--
Reply all
Reply to author
Forward
0 new messages