provide 'view/requestUrl' method to be used instead of 'request/URL'
This commit is contained in:
parent
97e7537c4c
commit
17eafd7895
1 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,6 +42,7 @@ from zope.formlib.namedtemplate import NamedTemplate
|
|||
from zope.interface import Interface, implements
|
||||
from zope.proxy import removeAllProxies
|
||||
from zope.publisher.browser import applySkin
|
||||
from zope.publisher.http import URLGetter as BaseURLGetter
|
||||
from zope.publisher.interfaces.browser import IBrowserSkinType, IBrowserView
|
||||
from zope import schema
|
||||
from zope.schema.vocabulary import SimpleTerm
|
||||
|
@ -187,6 +188,12 @@ class SortableMixin(object):
|
|||
return '/@@/cybertools.icons/arrowup.gif'
|
||||
|
||||
|
||||
class URLGetter(BaseURLGetter):
|
||||
|
||||
def __str__(self):
|
||||
return self.__request.getURL().rstrip('/@@index.html')
|
||||
|
||||
|
||||
class BaseView(GenericView, I18NView, SortableMixin):
|
||||
|
||||
actions = {}
|
||||
|
@ -209,6 +216,10 @@ class BaseView(GenericView, I18NView, SortableMixin):
|
|||
pass
|
||||
saveRequest(request)
|
||||
|
||||
@property
|
||||
def requestUrl(self):
|
||||
return URLGetter(self.request)
|
||||
|
||||
def todayFormatted(self):
|
||||
return formatDate(date.today(), 'date', 'short',
|
||||
self.languageInfo.language)
|
||||
|
|
Loading…
Add table
Reference in a new issue