| Index: appengine/findit/handlers/crash/crash_config.py
|
| diff --git a/appengine/findit/handlers/crash/crash_config.py b/appengine/findit/handlers/crash/crash_config.py
|
| index d3ed043f1bf60ce05c3648f53e5cb2087bba5ccd..fe6aec9b77e3140aa95368b2424113d3f4216583 100644
|
| --- a/appengine/findit/handlers/crash/crash_config.py
|
| +++ b/appengine/findit/handlers/crash/crash_config.py
|
| @@ -5,6 +5,9 @@
|
| """Handles requests to the crash config page."""
|
|
|
| import json
|
| +import pickle
|
| +import re
|
| +import zlib
|
|
|
| from google.appengine.api import users
|
|
|
| @@ -21,6 +24,8 @@ class CrashConfig(BaseHandler):
|
|
|
| data = {
|
| 'fracas': settings.fracas,
|
| + 'component_classifier': settings.str_component_classifier,
|
| + 'project_classifier': settings.project_classifier,
|
| }
|
|
|
| return {'template': 'crash/crash_config.html', 'data': data}
|
| @@ -28,6 +33,28 @@ class CrashConfig(BaseHandler):
|
| def HandlePost(self):
|
| data = self.request.params.get('data')
|
| new_config_dict = json.loads(data)
|
| +
|
| + component_config = new_config_dict['component_classifier']
|
| +
|
| + # Convert the pattern strings to re compiled objects.
|
| + path_function_component = []
|
| + for path, function, component in component_config.get(
|
| + 'path_function_component', []):
|
| + path_function_component.append((
|
| + re.compile(path),
|
| + re.compile(function) if function else None,
|
| + component))
|
| +
|
| + if path_function_component:
|
| + component_config['path_function_component'] = path_function_component
|
| +
|
| + # Compress component config since it may grow bigger.
|
| + new_config_dict['compressed_component_classifier'] = zlib.compress(
|
| + pickle.dumps(component_config))
|
| + # Delete the oringinal string component classifier settings since it's
|
| + # already be compressed 'compressed_component_classifier'.
|
| + del new_config_dict['component_classifier']
|
| +
|
| CrashConfigModel.Get().Update(
|
| users.get_current_user(), users.IsCurrentUserAdmin(), **new_config_dict)
|
| return self.HandleGet()
|
|
|