def __init__(self, json_data): self.relationName = None #enumeration: has as member / is member of / family of / related self.comments = None #Specific details about the relationship, e.g. 'sister' self.artist = None #Related artist self._initialize_fields_from_json_data({"relationName": voluptuous.any("member", "is member of", "family of", "related"), "comments": voluptuous.any(unicode, NoneType), "artist": coerce(ShsArtist)}, json_data) self.json_data = json_data
def __init__(self, json_data): self.entityType = None #string performance / recording (in case it is recorded) self.title = None #string title of the performance self.performer = None #performer performer self.date = None #partial date Performance or recording date. NOT the release date (see releases) self.releases = None #list of release Releases on which the performance has been released self.works = None #list of work Performed works. Usually just one work, except for medleys self.originals = None #list of work In case of a cover: original performances per work. Each work has an additional attribute 'original' referring to the original performance and an attribute 'isRootWork' (which is true if the work is not an adaptation) self.covers = None # list of performance In case of an original: list of covers self.derivedWorks = None # list of work In case of a cover: list of works derived from the work of the performance self.external_uri = None # youtube videos self._initialize_fields_from_json_data({required("entityType"): voluptuous.any(u"performance", u"recording"), required("uri"):basestring, "title": unicode, "performer": coerce(ShsPerformer), "date": isPartialDate, "releases":[coerce(ShsRelease)], "works": [coerce(ShsWork)], "originals": [coerce(ShsWork)], "covers": [coerce(ShsPerformance)], "derivedWorks": [coerce(ShsWork)], "external_uri": [unicode]}, json_data) self.json_data = json_data
def __init__(self, json_data): self.entityType = None #string audio album / audio single / internet / video self.title = None #string Title of the release self.type = None #string Release type. More specific than entityType self.date = None #partial date Release date self.label = None #label The label of the release self.catalogNr = None #string Catalog number self.ean = None #string EAN code self.picture = None #picture Picture of the release art self.tributes = None #list of artist Tributed artists self.performances = None #list of performance Release tracks self.external_uri = None #Discogs self._initialize_fields_from_json_data({required("entityType"): voluptuous.any(u"audio album", u"audio single", u"internet", u"video"), required("uri"):basestring, "title": unicode, "type": unicode, "date": isPartialDate, "label": coerce(ShsLabel), "catalogNr": unicode, "ean": _voluptuous_any_or_null(unicode), "picture": coerce(ShsPicture), "tributes": [coerce(ShsArtist)], "performances": [coerce(ShsPerformance)], "external_uri": [unicode], }, json_data) self.json_data = json_data
def __init__(self, json_data): self.entityType = None #string song / poem / film / proza self.title = None #string title of the work self.language = None #string language of the work self.credits = None #list of artist credited artists self.originalCredits = None #list of artist artists credits for the works on which this work is based self.original = None #performance original performance self.basedOn = None #list of work works on which this work is based self.derivedWorks = None #list of work works derived from this work self.versions = None #list of performance versions of this work self._initialize_fields_from_json_data({required("entityType"): voluptuous.any(u"song", u"poem", u"film", u"proza"), required("uri"):basestring, "title": unicode, "language": _voluptuous_any_or_null(unicode), "credits": [coerce(ShsArtist)], "originalCredits": [coerce(ShsArtist)], "original": coerce(ShsPerformance), "basedOn": [coerce(ShsWork)], "derivedWorks": [coerce(ShsWork)], "versions": [coerce(ShsPerformance)]}, json_data) self.json_data = json_data
def __init__(self, json_data): self.entityType = None #string artist / joint-artist self.commonName = None #string The name by which the artist is mostly referred to self.picture = None #picture (artist only) Picture of the artist self.birthDate = None #partial date (artist only) Birth date of the artist self.deathDate = None #partial date (artist only) Death date of the artist self.homeCountry = None # string (artist only) Country mostly associated with the artist self.comments = None #string (artist only) Comments self.aliases = None #list of string List of other names used by this artist self.relations = None #list of relation (artist only) Related artists self.members = None #list of artist (joint artist only) Artists that are part of the joint artist self.performances_uri = None self.creditedWorks_uri = None self.releases_uri = None self._getter_factory_functions = dict() self._initialize_fields_from_json_data({required("entityType"): voluptuous.any(u"artist" , u"joint-artist"), required("uri"):basestring, "commonName": unicode, "picture": coerce(ShsPicture), "birthDate": isPartialDate, "deathDate": isPartialDate, "homeCountry": unicode, "comments": unicode, "aliases": [unicode], "relations": [coerce(ShsRelation)], "members": [coerce(ShsArtist)], }, json_data) self._initialize_url_fields({"performances": lambda xs: [ShsPerformance(x) for x in xs], "creditedWorks": lambda xs: [ShsWork(x) for x in xs], "releases": lambda xs: [ShsRelease(x) for x in xs]}, json_data) self.json_data = json_data
from google.appengine.ext import ndb from skel.datastore import EntityBase import voluptuous import logging from datetime import datetime log_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'froms': basestring, 'tos': basestring, 'added': voluptuous.any(None, datetime, ''), 'type': basestring, 'message': basestring } log_query_schema = { 'flike_froms': basestring, 'flike_tos': basestring, 'feq_type': basestring } class Log(EntityBase): #date occurs log added = ndb.DateTimeProperty('d', auto_now_add=True) #from email or phone froms = ndb.StringProperty('fr') #to email or phone tos = ndb.StringProperty('to') #message to be logged
from google.appengine.ext import ndb import voluptuous from skel.datastore import EntityBase from skel.rest_api.rules import RestQueryRule ADMIN_GROUPS_ID = "admin__" STAFF_GROUPS_ID = "staff__" group_schema = { "key": voluptuous.any(None, voluptuous.ndbkey(), ""), "name": basestring, "notes": basestring, "default": voluptuous.boolean(), } group_query_schema = {"flike_name": basestring, "feq_default": voluptuous.boolean(), "feq_school": voluptuous.ndbkey()} class Group(EntityBase): """Represents a group.""" _query_properties = {"name": RestQueryRule("name_", lambda x: x.lower() if x else "")} # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty("v_", default=1) # Useful timestamps. added = ndb.DateTimeProperty("a_", auto_now_add=True) modified = ndb.DateTimeProperty("m_", auto_now=True)
from google.appengine.ext import ndb import voluptuous import os import uuid from skel.rest_api.rules import RestQueryRule from webapp2_extras import security from .school import School user_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'first_name': basestring, 'last_name': basestring, # 'default_school': voluptuous.ndbkey(), 'schools': [voluptuous.ndbkey()], # 'contacts': [{'type': basestring, 'value': basestring}], 'email': basestring, 'phone': basestring, 'password': basestring } user_query_schema = { 'flike_first_name': basestring, 'flike_phone': basestring, 'flike_email': basestring, 'feq_is_admin': voluptuous.boolean(), 'feq_schools': voluptuous.any('', voluptuous.ndbkey()), }
EVENT_STATUS_SENT = 'se' EVENT_UPDATE_QUEUE = 'event-update' EVENT_UPDATOR_ENDPOINT = '/task/event/update/event/counts' EVENT_UPDATOR_QUEUE = 'event-updator' COUNT_TYPE_MAP = { 'student': 'student_count', 'contact': 'contact_count', 'ack': 'responded_count' } event_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'title': basestring, 'status': voluptuous.any('', EVENT_STATUS_DRAFT, EVENT_STATUS_CLOSED, EVENT_STATUS_SENT), 'last_broadcast_date': voluptuous.any(None, basestring, voluptuous.datetime()), 'groups': [voluptuous.ndbkey()], 'school': voluptuous.ndbkey(), 'type': voluptuous.any('e', 'n'), 'counts': { 'contacts': int, 'students': int,
import os import sys import voluptuous from skel.rest_api.rules import RestQueryRule from skel.datastore import EntityBase from google.appengine.ext import ndb reply_message_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'message': voluptuous.ndbkey(), 'content': basestring, } reply_message_query_schema = { 'feq_message': voluptuous.ndbkey(), } class ReplyMessage(EntityBase): """Reply a Message.""" _query_properties = { 'name': RestQueryRule('n_', lambda x: x.lower() if x else ''), } # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty('v_', default=1) content = ndb.StringProperty('ct')
GROUPS_TX_ENDPOINT = "/task/event/tx/start" GROUP_TX_ENDPOINT = "/task/event/tx/group" GROUP_TX_QUEUE = "group-tx" STUDENT_TX_ENDPOINT = "/task/event/tx/student" STUDENT_TX_QUEUE = "student-tx" CONTACT_TX_ENDPOINT = "/task/event/tx/contact" CONTACT_TX_QUEUE = "contact-tx" METHOD_TX_ENDPOINT = "/task/event/tx/method" METHOD_TX_QUEUE = "method-tx" message_schema = { "key": voluptuous.any(None, voluptuous.ndbkey(), ""), "event": voluptuous.ndbkey(), "user": voluptuous.any(None, voluptuous.ndbkey(), ""), "user_name": basestring, "timestamp": voluptuous.any(None, datetime, ""), "type": basestring, "message": {"message": basestring, "sms": basestring, "title": basestring, "email": basestring}, } message_query_schema = { "feq_event": voluptuous.ndbkey(), "feq_user": voluptuous.any(None, voluptuous.ndbkey(), ""), "feq_message_type": basestring, }
import os from google.appengine.ext import ndb import voluptuous from skel.datastore import EntityBase from skel.rest_api.rules import RestQueryRule school_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'name': basestring, #'owner': voluptuous.ndbkey(), #'users': [voluptuous.ndbkey()], } school_query_schema = { 'flike_name': basestring, } class School(EntityBase): """Represents a school.""" _query_properties = { 'name': RestQueryRule('name_', lambda x: x.lower() if x else ''), } # Store the schema version, to aid in migrations.
from google.appengine.ext import ndb import voluptuous from skel.datastore import EntityBase from skel.rest_api.rules import RestQueryRule from sosbeacon.error_log import create_error_log from sosbeacon.group import Group DEFAULT_STUDENT_ID = "student__" EMAIL_REGEX = re.compile("^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$") student_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'first_name': basestring, 'last_name': basestring, # 'identifier': basestring, 'groups': [voluptuous.ndbkey()], 'contacts': [{ 'name': basestring, 'type': voluptuous.any('p', 'o', 'd'), 'notes': basestring, 'methods': [{'type': voluptuous.any('e', 't', 'p'), 'value': basestring}] }] } student_query_schema = { 'flike_first_name': basestring,
GROUPS_TX_ENDPOINT = '/task/event/tx/start' GROUP_TX_ENDPOINT = '/task/event/tx/group' GROUP_TX_QUEUE = "group-tx" STUDENT_TX_ENDPOINT = '/task/event/tx/student' STUDENT_TX_QUEUE = "student-tx" CONTACT_TX_ENDPOINT = '/task/event/tx/contact' CONTACT_TX_QUEUE = "contact-tx" METHOD_TX_ENDPOINT = '/task/event/tx/method' METHOD_TX_QUEUE = "method-tx" message_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'event': voluptuous.ndbkey(), 'user': voluptuous.any(None, voluptuous.ndbkey(), ''), 'user_name': basestring, 'timestamp': voluptuous.any(None, datetime, ''), 'type': basestring, 'message': { 'message': basestring, 'sms': basestring, 'title': basestring, 'email': basestring } } message_query_schema = { 'feq_event': voluptuous.ndbkey(),
from google.appengine.ext import ndb from skel.datastore import EntityBase import voluptuous import logging from datetime import datetime log_schema = { "key": voluptuous.any(None, voluptuous.ndbkey(), ""), "froms": basestring, "tos": basestring, "added": voluptuous.any(None, datetime, ""), "type": basestring, "message": basestring, } log_query_schema = {"flike_froms": basestring, "flike_tos": basestring, "feq_type": basestring} class Log(EntityBase): # date occurs log added = ndb.DateTimeProperty("d", auto_now_add=True) # from email or phone froms = ndb.StringProperty("fr") # to email or phone tos = ndb.StringProperty("to") # message to be logged message = ndb.StringProperty(indexed=False) type = ndb.StringProperty("tp")
from google.appengine.ext import ndb from skel.datastore import EntityBase import voluptuous import logging from datetime import datetime log_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'date': voluptuous.any(None, datetime, ''), 'message': basestring, 'event' : basestring } log_query_schema = { 'feq_type': basestring } class ErrorLog(EntityBase): #date occurs log added = ndb.DateTimeProperty('d', auto_now_add=True) #error to be logged message = ndb.StringProperty('ms') event = ndb.StringProperty() @classmethod def from_dict(cls, data): key = data.get("key") error_log = None
from google.appengine.ext import ndb import voluptuous from skel.datastore import EntityBase from skel.rest_api.rules import RestQueryRule from sosbeacon.error_log import create_error_log from sosbeacon.group import Group DEFAULT_STUDENT_ID = "student__" EMAIL_REGEX = re.compile("^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$") student_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'first_name': basestring, 'last_name': basestring, # 'identifier': basestring, 'groups': [voluptuous.ndbkey()], 'contacts': [{ 'name': basestring, 'type': voluptuous.any('p', 'o', 'd'), 'notes': basestring, 'methods': [{ 'type': voluptuous.any('e', 't', 'p'),
def _voluptuous_any_or_null(*args): return voluptuous.any(*(args + tuple([None])))
from google.appengine.ext import ndb import voluptuous import os import uuid from skel.rest_api.rules import RestQueryRule from webapp2_extras import security from .school import School user_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'first_name': basestring, 'last_name': basestring, # 'default_school': voluptuous.ndbkey(), 'schools': [voluptuous.ndbkey()], # 'contacts': [{'type': basestring, 'value': basestring}], 'email' : basestring, 'phone' : basestring, 'password' : basestring } user_query_schema = { 'flike_first_name': basestring, 'flike_phone': basestring, 'flike_email': basestring, 'feq_is_admin': voluptuous.boolean(), 'feq_schools': voluptuous.any('', voluptuous.ndbkey()), }