/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: 2014-07-17 00:49:30 UTC
  • Revision ID: teddy@recompile.se-20140717004930-tqfjwjvonrtfcr7w
mandos-ctl: Make it work in Python 3.

* mandos-ctl: Tolerate failure of importing future_builtins.  If
              Python 2, override "str" with "unicode".
  (print_clients): Use "str" instead of "unicode".
  (main): Use 'type=argparse.FileType(mode="rb")' instead of
          'type=file', and use the items() method instead of
          iteritems().

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
server_path = "/"
73
73
server_interface = domain + ".Mandos"
74
74
client_interface = domain + ".Mandos.Client"
75
 
version = "1.6.7"
 
75
version = "1.6.6"
76
76
 
77
77
def timedelta_to_milliseconds(td):
78
78
    """Convert a datetime.timedelta object to milliseconds"""
157
157
    token_duration = Token(re.compile(r"P"), None,
158
158
                           frozenset((token_year, token_month,
159
159
                                      token_day, token_time,
160
 
                                      token_week)))
 
160
                                      token_week))),
161
161
    # Define starting values
162
162
    value = datetime.timedelta() # Value so far
163
163
    found_token = None
164
 
    followers = frozenset((token_duration,)) # Following valid tokens
 
164
    followers = frozenset(token_duration,) # Following valid tokens
165
165
    s = duration                # String left to parse
166
166
    # Loop until end token is found
167
167
    while found_token is not token_end: