parse_isotime filter to parse a date string.
This then allows the resulting date value to be piped to one of the standard django date/time format filters This is identical to oslo timeutils parse_isotime, but annotated with @register.filter Required for blueprint: heat-ui Change-Id: Ibecca77d50bb5c0df59e07e9572069215229f60a
This commit is contained in:
parent
8259aab360
commit
6b6f97f7a8
@ -14,9 +14,25 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import iso8601
|
||||
|
||||
from django.template.defaultfilters import register
|
||||
|
||||
|
||||
@register.filter
|
||||
def replace_underscores(string):
|
||||
return string.replace("_", " ")
|
||||
|
||||
|
||||
@register.filter
|
||||
def parse_isotime(timestr):
|
||||
"""
|
||||
This duplicates oslo timeutils parse_isotime but with a
|
||||
@register.filter annotation.
|
||||
"""
|
||||
try:
|
||||
return iso8601.parse_date(timestr)
|
||||
except iso8601.ParseError as e:
|
||||
raise ValueError(e.message)
|
||||
except TypeError as e:
|
||||
raise ValueError(e.message)
|
||||
|
@ -6,7 +6,7 @@ set -o errexit
|
||||
# Increment me any time the environment should be rebuilt.
|
||||
# This includes dependncy changes, directory renames, etc.
|
||||
# Simple integer secuence: 1, 2, 3...
|
||||
environment_version=32
|
||||
environment_version=33
|
||||
#--------------------------------------------------------#
|
||||
|
||||
function usage {
|
||||
|
@ -5,6 +5,7 @@ pbr>=0.5,<0.6
|
||||
Django>=1.4,<1.6
|
||||
django_compressor
|
||||
django_openstack_auth>=1.0.8
|
||||
iso8601>=0.1.4
|
||||
netaddr
|
||||
python-cinderclient>=1.0.2,<2.0.0
|
||||
python-glanceclient<2
|
||||
|
Loading…
x
Reference in New Issue
Block a user