Exemplo n.º 1
0
import cgitb; cgitb.enable()
import log
log.set_level('SILENT')
log.set_templog("web.log")

import json
from webphp import php_get as get
from lib.files import safe_filename
from credentials import GIT_THEMING_PATH
import os.path
import os
import tempfile



def handle_query():
    """
    Handle any and all web submits.
    """
    action = get("action")
    log.debug("responding to: %s", action)

    ## queries for each object type available
    if action == "protostory":
        data = (get("storyentry") or "").strip()
        rows = data.split("\n")
        sid = None
        path = None
        results = []
        retval = {}
        overwrite = False
Exemplo n.º 2
0
#import cgitb; cgitb.enable()
import log
log.set_level('SILENT')
log.set_templog("web.log")

import webobject
import json
from webphp import php_get as get
from webquerylib import (
    cached_special_query, )

OBJECT_TYPES = {
    "story": webobject.Story,
    "theme": webobject.Theme,
    "storytheme": webobject.StoryTheme,
    "event": webobject.TSTPEvent,
    "proposedevents": webobject.TSTPEvent,
}


def handle_submit(obj_type):
    """
    Do the db-update part of the query.
    """
    if issubclass(obj_type, webobject.TSTPConnection):
        update = get("data")
        attrs = [x[0] for x in update]
        vals = [x[1] for x in update]
        cat1 = get("type1")
        name1 = get("filter1")
        cat2 = get("type2")