Пример #1
0
def create(data, notifData=None):
    """
    Create an event document.
    Parameters:
        data - a dictionary of the event data.
        notifData - a dictionary of data to be sent in the notifications.
    Returns:
        an event document.
    """
    db = core.connect()
    theTime = utils.utctime()
    data["created"] = theTime
    data["modified"] = theTime
    # create notification events
    notifications = stream.notifications(data["streamId"])
    for userId in notifications:
        create({
                "createdBy": data.get("createdBy"),
                "displayString": data.get("displayString"),
                "streamId": user.messageStream(userId),
                "unread": True,
                "content": data.get("content")
                })
    newEvent = schema.event()
    newEvent.update(data)
    newEvent["type"] = "event"
    return db.create(newEvent)
Пример #2
0
def add_event(title=None, description=None, start_date=None, start_time=None, \
    end_date=None, end_time=None, location=None, latlng=None, owner=None):
    if not title or not description or not location:
        raise NameError('You must specify a title, description, and location')
    db = application.get_db_connection()
    data = schema.event(title=title, description=description, start_date=start_date, \
        start_time=start_time, end_date=end_date, end_time=end_time, \
        location=location, latlng=latlng, owner=owner)
    return db.events.insert(data)
Пример #3
0
def add_event(title=None, description=None, start_date=None, start_time=None, \
    end_date=None, end_time=None, location=None, latlng=None, owner=None):
    if not title or not description or not location:
        raise NameError('You must specify a title, description, and location')
    db = application.get_db_connection()
    data = schema.event(title=title, description=description, start_date=start_date, \
        start_time=start_time, end_date=end_date, end_time=end_time, \
        location=location, latlng=latlng, owner=owner)
    return db.events.insert(data)