~uclgd/gdunity/main

« back to all changes in this revision

Viewing changes to io.py

  • Committer: Romain Van Vooren
  • Date: 2011-12-02 18:09:45 UTC
  • Revision ID: romainvv@gmail.com-20111202180945-34ridvylpsgnb8x2
to be continued

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import rfc3339
3
3
import datetime
4
4
import getpass
 
5
from keyring import *
 
6
from ui import *
 
7
import optparse
5
8
 
6
9
def addFile(node, path):
7
10
  f = open(path, 'w+')
22
25
  
23
26
def readConfigFile(filename):
24
27
  res = []
 
28
  login, mdp = get_credentials()
 
29
  if mdp == "":
 
30
    login, mdp = echoDiagCredentials()
 
31
    set_credentials(login, mdp)
 
32
    #login = raw_input("Adress mail : ")
 
33
    #passw = getpass.getpass("Pass : ")
25
34
  if (os.path.isfile(filename) == True):
26
35
    f = open(filename, 'r')
27
36
    res.append(f.readline().strip())
28
 
    res.append(f.readline().strip())
29
 
    res.append(f.readline().strip())
30
37
    f.close()
31
38
  else: # default configuration
32
39
    lastupdate = rfc3339.rfc3339(datetime.datetime.now()-datetime.timedelta(minutes=4)).replace("+", "%2B")
 
40
 
33
41
    res.append(lastupdate)
34
 
    res.append(raw_input("Adress mail : "))
35
 
    res.append(getpass.getpass("Pass : "))
 
42
 
 
43
  res.append(login)
 
44
  res.append(mdp)
36
45
  return res
37
46
 
38
47
 
 
48
 
 
49
def parse_options():
 
50
    """Support for command line options"""
 
51
    parser = optparse.OptionParser("gduntiy [OPTION]")
 
52
    parser.add_option(
 
53
        "-c", "--conf", action="store_true", dest="CONFIG", help="Show the config dialogs")
 
54
    parser.add_option(
 
55
        "-e", "--extract", dest="FORMAT", help="Extract the file to the given format (pdf)")
 
56
    return parser.parse_args()
 
57
 
 
58
 
 
 
b'\\ No newline at end of file'