示例#1
0
#!/usr/bin/env python

import webapp2
import yamlmodels
from page_builder import managers
import re
import testcontrollers

models = yamlmodels.load()

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.out.write('Hello world!')

class TestHandler(webapp2.RequestHandler):
    def get(self):
        content_type = self.request.get('format')
        
        self.response.headers['Content-Type'] = str(content_type) or 'text/plain'
        
        def string_convert(item):
            return str(item[0]),item[1]
            
        request_dict = dict(map(string_convert, self.request.GET.items()))
        
        module_name = self.request.get('module')
        module_name = re.sub('\.+','.',module_name.lstrip('.'))
        test_name = self.request.get('test')
        
        for key in ['format','module','test']:
            if key in request_dict:
示例#2
0
文件: dj.py 项目: Samnsparky/Sirpple
#!/usr/bin/env python

import sys

from serialization.config_model import ConfigModelFactory
from serialization import model_graph
from google.appengine.ext.db import Query
#from compiler import astbuilder

import yamlmodels

globals().update(yamlmodels.load())

def populate_db():
    proj = Project()
    proj.name = 'Test Project'
    proj.put()
    
    world = World(parent=proj)
    world.name = 'World 1'
    world.put()
    
    proj.starting_world = world
    proj.put()
    
    cons = WorldMethod(parent=world)
    cons.name = 'World 1 constructor'
    cons.signature = '{}'
    cons.body_type = 'raw'
    cons.body = 'document.write("hello Sirpple")'
    cons.put()