Make start dates work for all modules

* error modules now hidden via access control
* get_module() returns None if user doesn't have access
This commit is contained in:
Victor Shnayder
2012-08-14 22:56:56 -04:00
parent 2df3a6ef11
commit b782e2ff5d
11 changed files with 106 additions and 41 deletions

View File

@@ -3,9 +3,17 @@ Helper functions for handling time in the format we like.
"""
import time
TIME_FORMAT = "%Y-%m-%dT%H:%M"
def parse_time(time_str):
"""
Takes a time string in our format ("%Y-%m-%dT%H:%M"), and returns
Takes a time string in TIME_FORMAT, returns
it as a time_struct. Raises ValueError if the string is not in the right format.
"""
return time.strptime(time_str, "%Y-%m-%dT%H:%M")
return time.strptime(time_str, TIME_FORMAT)
def stringify_time(time_struct):
"""
Convert a time struct to a string
"""
return time.strftime(TIME_FORMAT, time_struct)