Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/extensions/utils.py

Issue 6282067956465664: Issue 399 - Added support for Safari to updateDownloadLinks (Closed)
Patch Set: Addressed comments Created April 30, 2014, 12:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/extensions/bin/updateDownloadLinks.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH 4 # Copyright (C) 2006-2014 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 in the configuration file. 189 in the configuration file.
190 This static method will enumerate Configuration 190 This static method will enumerate Configuration
191 objects representing the settings for each repository. 191 objects representing the settings for each repository.
192 """ 192 """
193 config = get_config() 193 config = get_config()
194 for key, value in config.items("extensions"): 194 for key, value in config.items("extensions"):
195 if key.endswith("_repository"): 195 if key.endswith("_repository"):
196 repositoryName = re.sub(r'_repository$', '', key) 196 repositoryName = re.sub(r'_repository$', '', key)
197 if repositoryName: 197 if repositoryName:
198 yield Configuration(config, nightlyConfig, repositoryName, value) 198 yield Configuration(config, nightlyConfig, repositoryName, value)
199
200 def getSafariCertificateID(keyFile):
201 import M2Crypto
202
203 bio = M2Crypto.BIO.openfile(keyFile)
204 try:
205 while True:
206 try:
207 cert = M2Crypto.X509.load_cert_bio(bio)
208 except M2Crypto.X509.X509Error:
209 raise Exception('No safari developer certificate found in chain')
210
211 subject = cert.get_subject()
212 for entry in subject.get_entries_by_nid(subject.nid['CN']):
213 m = re.match(r'Safari Developer: \((.*?)\)', entry.get_data().as_text())
214 if m:
215 return m.group(1)
216 finally:
217 bio.close()
OLDNEW
« no previous file with comments | « sitescripts/extensions/bin/updateDownloadLinks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld