Beispiel #1
0
 def setUp(self):
     # Note that you're calling super on MyTestCase, not
     # on DataStoreTestCase!
     super(Data_ModelTest, self).setUp()
     # Populate test entities here along with other setup.
     data_model = Data_Model()
     data_model.put_data('setup_01')
     self.setup_key = data_model.get_key()
Beispiel #2
0
class Cms(webapp2.RequestHandler):
    def __init__(self, request, response, **kwargs):
        # webapp2.RequestHandler.__init__(self, request, response, **kwargs)
        self.initialize(request, response, **kwargs)
        self.data_model = Data_Model()

    def get(self):
        self.response.headers["Content-Type"] = "text/html"
        name = self.request.get("name", "World")
        self.response.write("<html><body>Hello, %s!</body></html>" % name)
        self.save_name(name)

    def save_name(self, name):
        self.data_model.put_data(name)
Beispiel #3
0
class Cms(webapp2.RequestHandler):
    def __init__(self, request, response, **kwargs):
        #webapp2.RequestHandler.__init__(self, request, response, **kwargs)
        self.initialize(request, response, **kwargs)
        #root_model = Root_Model()
        #self.rkey=root_model.put_data('this is root one')
        self.data_model = Data_Model(parent=Data_Model.get_url_key('ag5kZXZ-ZGVidWdkdWRlN3IXCxIKUm9vdF9Nb2RlbBiAgICAgOD_CQw'))

    def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        name = self.request.get('name', 'World')
        self.save_name(name)
        self.response.write("<html><body>")
        self.response.write("<br><br>Hello, %s!</body></html>" % name)

    def save_name(self, name):
        self.data_model.put_data(name)

    def get_names(self, key):
        res=''
        names = Data_Model.query_model(key).fetch(20)
        for nm in names:
            res=res+'<blockquote>%s</blockquote>' % nm.name
        return res
Beispiel #4
0
 def __init__(self, request, response, **kwargs):
     # webapp2.RequestHandler.__init__(self, request, response, **kwargs)
     self.initialize(request, response, **kwargs)
     self.data_model = Data_Model()
Beispiel #5
0
 def test_saved_enitity(self):
     """This is test saved entity"""
     data_model = Data_Model()
     data_model.put_data('setup_02')
     key = data_model.get_key()
     self.assertEqual('setup_02', key.get().name)
Beispiel #6
0
 def __init__(self, request, response, **kwargs):
     #webapp2.RequestHandler.__init__(self, request, response, **kwargs)
     self.initialize(request, response, **kwargs)
     #root_model = Root_Model()
     #self.rkey=root_model.put_data('this is root one')
     self.data_model = Data_Model(parent=Data_Model.get_url_key('ag5kZXZ-ZGVidWdkdWRlN3IXCxIKUm9vdF9Nb2RlbBiAgICAgOD_CQw'))
Beispiel #7
0
 def get_names(self, key):
     res=''
     names = Data_Model.query_model(key).fetch(20)
     for nm in names:
         res=res+'<blockquote>%s</blockquote>' % nm.name
     return res
Beispiel #8
0
 def set_up(self):
     # Populate test entities here along with other setup.
     data_model = Data_Model()
     data_model.put_data('setup_01')
     self.setup_key = data_model.get_key()