/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2012-06-23 00:58:49 UTC
  • Revision ID: teddy@recompile.se-20120623005849-02wj82cng433rt2k
* clients.conf: Convert all time intervals to new RFC 3339 syntax.
* mandos: All client options for time intervals now take an RFC 3339
          duration.
  (rfc3339_duration_to_delta): New function.
  (string_to_delta): Try rfc3339_duration_to_delta first.
* mandos-clients.conf.xml (OPTIONS/timeout): Document new format.
  (EXAMPLE): Update to new interval format.
  (SEE ALSO): Reference RFC 3339.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
 
86
86
 
87
87
def rfc3339_duration_to_delta(duration):
88
 
    """Parse a RFC 3339 "duration" and return a datetime.timedelta
 
88
    """Parse an RFC 3339 "duration" and return a datetime.timedelta
89
89
    
90
90
    >>> rfc3339_duration_to_delta("P7D")
91
91
    datetime.timedelta(7)
103
103
    datetime.timedelta(1, 200)
104
104
    """
105
105
    
106
 
    # Parsing a RFC 3339 duration with regular expressions is not
 
106
    # Parsing an RFC 3339 duration with regular expressions is not
107
107
    # possible - there would have to be multiple places for the same
108
 
    # values, like seconds.  This, while more esoteric, is cleaner
109
 
    # without depending on a parsing library.  If Python had a
 
108
    # values, like seconds.  The current code, while more esoteric, is
 
109
    # cleaner without depending on a parsing library.  If Python had a
110
110
    # built-in library for parsing we would use it, but we'd like to
111
111
    # avoid excessive use of external libraries.
112
112