* add a days_early_for_beta inherited policy option
* students in the beta_testers_{COURSE} group get to see content that many days early
* Clean up some docstrings related to time formats
* Add basic test
23 lines
478 B
Python
23 lines
478 B
Python
"""
|
|
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 TIME_FORMAT
|
|
|
|
Returns it as a time_struct.
|
|
|
|
Raises ValueError if the string is not in the right format.
|
|
"""
|
|
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)
|