李迎辉

李迎辉的博客

他的个人主页  他的博客

Uliweb中的App URL前缀定义

李迎辉  2009年10月13日 星期二 22:08 | 1836次浏览 | 0条评论

You know, Uliweb uses expose() to define url, for example:

@expose('/index')

But when you want to change the url suffix for an App, you should edit every views file(of cause you can use static urls.py appoach, but I won't talk about it now). Fox example how to change '/wiki/*' to '/mywiki/*'? So I add this new feature to Uliweb, so that you can define the URL suffix for an App, just adding an entry to URL session, for example:

[URL]
wiki = '/wiki'

If you didn't define an entry for wiki app, all urls in wiki app won't be changed at all. But if you define wiki='/wiki' in settings, all urls in wiki app will be added '/wiki' automatically, even though the urls is started with '/'. So '/index' will be converted to '/wiki/index'. So for above problem, you can just change wiki='/mywiki'.

And the entry key will be the appname, it's the same with app module name, for example: uliweb.contrib.admin, etc.

So in this feature, you can easily change an app URL suffix.

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号