(message)
A hacky kludge to support cia.vc XML-RPC requests.
A hacky kludge to support cia.vc XML-RPC requests.
A hacky kludge to support cia . vc XML - RPC requests .
def deliver(message):
    """
    A hacky kludge to support cia.vc XML-RPC requests.
    """
    # Must be imported here due to the circular nature of
    # Hook <-> HookService.
    from notifico.models import Hook, Project

    key = request.args.get('key')
    pid = request.args.get('pid')
    if pid:
        try:
            pid = int(pid)
        except ValueError:
            abort(404)

    h = Hook.query.filter_by(key=key, project_id=pid).first()
    if not h:
        return abort(404)

    # Increment the hooks message_count....
    Hook.query.filter_by(id=h.id).update({
        Hook.message_count: Hook.message_count + 1
    })
    # ... and the project-wide message_count.
    Project.query.filter_by(id=h.project.id).update({
        Project.message_count: Project.message_count + 1
    })

    hook = HookService.services.get(h.service_id)
    if hook is None:
        return ''

    hook._request(h.project.owner, request, h, message)
    db.session.commit()
def deliver ( message ) : # Must be imported here due to the circular nature of # Hook <-> HookService. from notifico . models import Hook , Project key = request . args . get ( 'key' ) pid = request . args . get ( 'pid' ) if pid : try : pid = int ( pid ) except ValueError : abort ( 404 ) h = Hook . query . filter_by ( key = key , project_id = pid ) . first ( ) if not h : return abort ( 404 ) # Increment the hooks message_count.... Hook . query . filter_by ( id = h . id ) . update ( { Hook . message_count : Hook . message_count + 1 } ) # ... and the project-wide message_count. Project . query . filter_by ( id = h . project . id ) . update ( { Project . message_count : Project . message_count + 1 } ) hook = HookService . services . get ( h . service_id ) if hook is None : return '' hook . _request ( h . project . owner , request , h , message ) db . session . commit ( )