/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

  • Committer: Teddy Hogeborn
  • Date: 2015-05-31 15:56:58 UTC
  • Revision ID: teddy@recompile.se-20150531155658-l7znu7zlqr2dmuwd
mandos: Generate better messages in exceptions.

mandos (ProxyClient.__init__): Include fingerprint in KeyError().
(rfc3339_duration_to_delta): Include duration in ValueError().

Show diffs side-by-side

added added

removed removed

Lines of Context:
2182
2182
    # avoid excessive use of external libraries.
2183
2183
    
2184
2184
    # New type for defining tokens, syntax, and semantics all-in-one
 
2185
    Token = collections.namedtuple("Token",
 
2186
                                   ("regexp", # To match token; if
 
2187
                                              # "value" is not None,
 
2188
                                              # must have a "group"
 
2189
                                              # containing digits
 
2190
                                    "value",  # datetime.timedelta or
 
2191
                                              # None
 
2192
                                    "followers")) # Tokens valid after
 
2193
                                                  # this token
2185
2194
    Token = collections.namedtuple("Token", (
2186
2195
        "regexp",  # To match token; if "value" is not None, must have
2187
2196
                   # a "group" containing digits
2222
2231
    # Define starting values
2223
2232
    value = datetime.timedelta() # Value so far
2224
2233
    found_token = None
2225
 
    followers = frozenset((token_duration, )) # Following valid tokens
 
2234
    followers = frozenset((token_duration,)) # Following valid tokens
2226
2235
    s = duration                # String left to parse
2227
2236
    # Loop until end token is found
2228
2237
    while found_token is not token_end: