summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Mekin <amekin@crystalnix.com>2016-08-30 17:14:30 +0600
committerAndrey Mekin <amekin@crystalnix.com>2016-08-30 17:14:30 +0600
commitf367a28e7b87cb9a8298515cf8362819342b9c45 (patch)
tree964e4aaaeb6deed7569e61d497b3f379adaf64c4
parent28ce01b8710f29afbba96f02f5ed92ca3412caa6 (diff)
parentd2342fd96ef8308207e324ff64005f59510f60b4 (diff)
downloadomaha-server-f367a28e7b87cb9a8298515cf8362819342b9c45.zip
omaha-server-f367a28e7b87cb9a8298515cf8362819342b9c45.tar.gz
omaha-server-f367a28e7b87cb9a8298515cf8362819342b9c45.tar.bz2
Merge branch 'dev'
-rw-r--r--CONTRIBUTING.md9
-rw-r--r--omaha_server/omaha/builder.py4
-rw-r--r--omaha_server/omaha/parser.py6
-rw-r--r--omaha_server/omaha/request.xsd1
-rw-r--r--omaha_server/omaha/statistics.py4
5 files changed, 19 insertions, 5 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..4e455a0
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,9 @@
+#Contributing to Omaha-server
+
+Omaha-server is an open source project and Crystalnix as the owner welcomes everyone who would like to help us by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.
+
+In general, we stick to [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/) with one modification which is important for us:
+
+* **Pull requests.** Please, post your pull requests to the “dev” branch instead of “master”. We’re using the “master” branch only for stable changes.
+
+Please, don’t forget about [PEP 8](https://www.python.org/dev/peps/pep-0008/) (Style Guide for Python Code) and unit-tests, it’ll increase the chance that your pull request will be accepted.
diff --git a/omaha_server/omaha/builder.py b/omaha_server/omaha/builder.py
index 323898b..8e26a91 100644
--- a/omaha_server/omaha/builder.py
+++ b/omaha_server/omaha/builder.py
@@ -31,8 +31,8 @@ from cacheops import cached_as
from omaha import tasks
from omaha.models import Version
from omaha.parser import parse_request
+from omaha import parser
from omaha.statistics import is_user_active
-from omaha.settings import DEFAULT_CHANNEL
from omaha.core import (Response, App, Updatecheck_negative, Manifest, Updatecheck_positive,
Packages, Package, Actions, Action, Event, Data)
@@ -133,7 +133,7 @@ def on_app(apps_list, app, os, userid):
app_id = app.get('appid')
version = app.get('version')
platform = os.get('platform')
- channel = app.get('tag') or DEFAULT_CHANNEL
+ channel = parser.get_channel(app)
ping = bool(app.findall('ping'))
events = reduce(on_event, app.findall('event'), [])
build_app = partial(App, app_id, status='ok', ping=ping, events=events)
diff --git a/omaha_server/omaha/parser.py b/omaha_server/omaha/parser.py
index f2a8436..625423b 100644
--- a/omaha_server/omaha/parser.py
+++ b/omaha_server/omaha/parser.py
@@ -21,7 +21,7 @@ the License.
import os
from lxml import etree, objectify
-
+from omaha.settings import DEFAULT_CHANNEL
__all__ = ['parser', 'parse_request']
@@ -79,3 +79,7 @@ def parse_request(request):
'{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}'
"""
return objectify.fromstring(request, parser)
+
+
+def get_channel(app):
+ return app.get('tag') or app.get('ap') or DEFAULT_CHANNEL
diff --git a/omaha_server/omaha/request.xsd b/omaha_server/omaha/request.xsd
index 5d999fb..d4b9375 100644
--- a/omaha_server/omaha/request.xsd
+++ b/omaha_server/omaha/request.xsd
@@ -98,6 +98,7 @@
<xs:attribute name='cohort' use='optional' type='xs:string'/>
<xs:attribute name='cohorthint' use='optional' type='xs:string'/>
<xs:attribute name='cohortname' use='optional' type='xs:string'/>
+ <xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
<xs:element name='updatecheck'>
diff --git a/omaha_server/omaha/statistics.py b/omaha_server/omaha/statistics.py
index cd20e4c..bb730de 100644
--- a/omaha_server/omaha/statistics.py
+++ b/omaha_server/omaha/statistics.py
@@ -30,7 +30,7 @@ from bitmapist import setup_redis, mark_event, unmark_event, WeekEvents, MonthEv
import pytz
from omaha.utils import get_id, is_new_install, valuedispatch, redis
-from omaha.settings import DEFAULT_CHANNEL
+from omaha import parser
from omaha.models import ACTIVE_USERS_DICT_CHOICES, Request, AppRequest, Os, Hw, Event, Version, Channel
from sparkle.models import SparkleVersion
@@ -52,7 +52,7 @@ def add_app_statistics(userid, platform, app, now=None):
now = timezone.now()
appid = app.get('appid')
version = app.get('version')
- channel = app.get('tag') or DEFAULT_CHANNEL
+ channel = parser.get_channel(app)
events = app.findall('event')
err_events = filter(lambda x: x.get('eventresult') not in ['1', '2', '3'], events)
if err_events: