Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: chrome/common/extensions/docs/server2/subversion_file_system.py

Issue 13896007: Devserver: run the cron over the examples. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try again to avoid .svn Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode 5 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode
6 from future import Future 6 from future import Future
7 import logging 7 import logging
8 import re 8 import re
9 import xml.dom.minidom as xml 9 import xml.dom.minidom as xml
10 from xml.parsers.expat import ExpatError 10 from xml.parsers.expat import ExpatError
(...skipping 18 matching lines...) Expand all
29 dom = xml.parseString(directory) 29 dom = xml.parseString(directory)
30 files = [elem.childNodes[0].data for elem in dom.getElementsByTagName('a')] 30 files = [elem.childNodes[0].data for elem in dom.getElementsByTagName('a')]
31 if '..' in files: 31 if '..' in files:
32 files.remove('..') 32 files.remove('..')
33 return files 33 return files
34 34
35 def Get(self): 35 def Get(self):
36 for path, future in self._fetches: 36 for path, future in self._fetches:
37 result = future.Get() 37 result = future.Get()
38 if result.status_code == 404: 38 if result.status_code == 404:
39 raise FileNotFoundError(path) 39 raise FileNotFoundError('Got 404 when fetching %s for Get' % path)
40 elif path.endswith('/'): 40 elif path.endswith('/'):
41 self._value[path] = self._ListDir(result.content) 41 self._value[path] = self._ListDir(result.content)
42 elif not self._binary: 42 elif not self._binary:
43 self._value[path] = ToUnicode(result.content) 43 self._value[path] = ToUnicode(result.content)
44 else: 44 else:
45 self._value[path] = result.content 45 self._value[path] = result.content
46 if self._error is not None: 46 if self._error is not None:
47 raise self._error 47 raise self._error
48 return self._value 48 return self._value
49 49
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 for path, version in child_versions.iteritems())) 118 for path, version in child_versions.iteritems()))
119 119
120 # Bleh, but, this data is so unreliable. There are actually some empty file 120 # Bleh, but, this data is so unreliable. There are actually some empty file
121 # listings caused by git/svn/something not cleaning up empty dirs. 121 # listings caused by git/svn/something not cleaning up empty dirs.
122 return StatInfo('0', {}) 122 return StatInfo('0', {})
123 123
124 def Stat(self, path): 124 def Stat(self, path):
125 directory = path.rsplit('/', 1)[0] 125 directory = path.rsplit('/', 1)[0]
126 result = self._stat_fetcher.Fetch(directory + '/') 126 result = self._stat_fetcher.Fetch(directory + '/')
127 if result.status_code == 404: 127 if result.status_code == 404:
128 raise FileNotFoundError(path) 128 raise FileNotFoundError(
129 'Got 404 when fetching %s from %s for Stat' % (path, directory))
129 stat_info = self._CreateStatInfo(result.content) 130 stat_info = self._CreateStatInfo(result.content)
130 if not path.endswith('/'): 131 if not path.endswith('/'):
131 filename = path.rsplit('/', 1)[-1] 132 filename = path.rsplit('/', 1)[-1]
132 if filename not in stat_info.child_versions: 133 if filename not in stat_info.child_versions:
133 raise FileNotFoundError(path) 134 raise FileNotFoundError('%s was not in child versions' % filename)
134 stat_info.version = stat_info.child_versions[filename] 135 stat_info.version = stat_info.child_versions[filename]
135 return stat_info 136 return stat_info
136 137
137 @classmethod 138 @classmethod
138 def GetVersion(cls): 139 def GetVersion(cls):
139 return _VERSION 140 return _VERSION
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698