Index: chrome/common/extensions/docs/server2/appengine_wrappers.py |
diff --git a/chrome/common/extensions/docs/server2/appengine_wrappers.py b/chrome/common/extensions/docs/server2/appengine_wrappers.py |
index 745ec35fbee58b1ffc10a6b0fd021d62e291bb6e..86a43e4940fc6268f32b6b3ffd8f8d476a45eb29 100644 |
--- a/chrome/common/extensions/docs/server2/appengine_wrappers.py |
+++ b/chrome/common/extensions/docs/server2/appengine_wrappers.py |
@@ -4,19 +4,16 @@ |
import os |
+from app_yaml_helper import AppYamlHelper |
+ |
def GetAppVersion(): |
if 'CURRENT_VERSION_ID' in os.environ: |
# The version ID looks like 2-0-25.36712548, we only want the 2-0-25. |
return os.environ['CURRENT_VERSION_ID'].split('.', 1)[0] |
- # Not running on appengine, get it from the app.yaml file ourselves. We |
- # could properly parse this using a yaml library but Python doesn't have |
- # one built in so whatevs. |
- version_key = 'version:' |
+ # Not running on appengine, get it from the app.yaml file ourselves. |
app_yaml_path = os.path.join(os.path.split(__file__)[0], 'app.yaml') |
with open(app_yaml_path, 'r') as app_yaml: |
- version_line = [line for line in app_yaml.read().split('\n') |
- if line.startswith(version_key)][0] |
- return version_line[len(version_key):].strip() |
+ return AppYamlHelper.ExtractVersion(app_yaml.read()) |
def IsDevServer(): |
return os.environ.get('SERVER_SOFTWARE', '').find('Development') == 0 |