Commit af69dfb1 authored by hupantingxue's avatar hupantingxue

Add options object;

parent 5b8d8f98
import re import re
DEVICE_TOKEN_FORMAT = re.compile(r'^[0-9a-fA-F]{64}$') # Value selectors; aliases, tags, etc.
PIN_FORMAT = re.compile(r'^[0-9a-fA-F]{8}$')
UUID_FORMAT = re.compile(
r'^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}'
r'-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$')
# Value selectors; device IDs, aliases, tags, etc.
def tag(tag): def tag(tag):
"""Select a single tag.""" """Select a single tag."""
......
...@@ -3,7 +3,6 @@ import re ...@@ -3,7 +3,6 @@ import re
# Valid autobadge values: auto, +N, -N # Valid autobadge values: auto, +N, -N
VALID_AUTOBADGE = re.compile(r'^(auto|[+-][\d]+)$') VALID_AUTOBADGE = re.compile(r'^(auto|[+-][\d]+)$')
def notification(alert=None, ios=None, android=None, winphone=None): def notification(alert=None, ios=None, android=None, winphone=None):
"""Create a notification payload. """Create a notification payload.
...@@ -137,7 +136,7 @@ def platform(*types): ...@@ -137,7 +136,7 @@ def platform(*types):
>>> platform('ios', 'symbian') >>> platform('ios', 'symbian')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValueError: Invalid device type 'symbian' ValueError: Invalid platform 'symbian'
""" """
if len(types) == 1 and types[0] == 'all': if len(types) == 1 and types[0] == 'all':
...@@ -146,3 +145,7 @@ def platform(*types): ...@@ -146,3 +145,7 @@ def platform(*types):
if t not in ('ios', 'android', 'winphone'): if t not in ('ios', 'android', 'winphone'):
raise ValueError("Invalid platform '%s'" % t) raise ValueError("Invalid platform '%s'" % t)
return [t for t in types] return [t for t in types]
def options(options):
"""Create options object."""
return {"options": options}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment