Mercurial > repos > yating-l > gonramp_apollo_tools
comparison apollo/ApolloUser.py @ 1:78af01d73add draft
planemo upload for repository https://github.com/Yating-L/suite_gonramp_apollo.git commit 9009fa8663038d2cb4a1c5130600a51f31f654a1-dirty
| author | yating-l |
|---|---|
| date | Tue, 28 Nov 2017 12:43:22 -0500 |
| parents | 1da8b9042af4 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:1da8b9042af4 | 1:78af01d73add |
|---|---|
| 43 delimiter = ',' | 43 delimiter = ',' |
| 44 else: | 44 else: |
| 45 self.logger.error("The %s format is not supported!", file_format) | 45 self.logger.error("The %s format is not supported!", file_format) |
| 46 with open(filename, 'r') as f: | 46 with open(filename, 'r') as f: |
| 47 lines = f.readlines() | 47 lines = f.readlines() |
| 48 headers = lines[0].rstrip().split(delimiter) | 48 headers = lines[0].split(delimiter) |
| 49 users = [] | 49 users = [] |
| 50 lines = lines[1:] | 50 lines = lines[1:] |
| 51 for l in lines: | 51 for l in lines: |
| 52 print l | |
| 53 l = l.split(delimiter) | 52 l = l.split(delimiter) |
| 54 info = dict() | 53 info = dict() |
| 55 fields = len(l) | 54 fields = len(l) |
| 56 for i in range(fields): | 55 for i in range(fields): |
| 57 info[headers[i]] = l[i] | 56 title = headers[i].rstrip() |
| 57 info[title] = l[i].rstrip() | |
| 58 users.append(info) | 58 users.append(info) |
| 59 return users | 59 return users |
| 60 | 60 |
| 61 def deleteApolloUser(self): | 61 def deleteApolloUser(self): |
| 62 for user in self.users_list: | 62 for user in self.users_list: |
| 91 for u in users: | 91 for u in users: |
| 92 if not 'useremail' in u: | 92 if not 'useremail' in u: |
| 93 self.logger.error("Cannot find useremail in the text file, make sure you use the correct header, see README file for examples.") | 93 self.logger.error("Cannot find useremail in the text file, make sure you use the correct header, see README file for examples.") |
| 94 if not 'group' in u: | 94 if not 'group' in u: |
| 95 self.logger.error("Cannot find group in the text file, make sure you use the correct header, see README file for examples.") | 95 self.logger.error("Cannot find group in the text file, make sure you use the correct header, see README file for examples.") |
| 96 subtools.arrow_add_to_group(u['group'], u['useremail']) | 96 subtools.arrow_remove_from_group(u['group'], u['useremail']) |
| 97 | 97 |
| 98 | 98 |
