Esempio n. 1
0
def create_subject(handler, name, description):
    # handlers root level topic differently
    topic = models._create_topic(name, description)
    _update_cached_tree(topic)

    topic_id = topic.key().__str__()
    return { "subject_id" : topic_id }
Esempio n. 2
0
def create_topic(handler, name, description, parent_id=None):
    if not parent_id:
        raise ValueError("Parent topic is required.")
    else:
        parent_key = models.get_key(parent_id)	
	parent = models.Topic.get(parent_key)
    
    topic = models._create_topic(name, description, parent)
    _update_cached_tree(topic, parent_key.name())

    return { "topic_id" : topic.key().__str__() }