コード例 #1
0
ファイル: tests.py プロジェクト: miraclestyle/miraclestyle
        if self.request.get('rr'):
            orm.delete_multi(TestP.query().fetch(keys_only=True))
        pp = self.request.get('pp')
        cc = self.request.get('cc')
        if pp and cc:
            outer = TestP(id=pp,
                          tests1=[TestA(name='foobar1', gaa=1)],
                          tests2=TestB(name='foobar2', gaa=2))
            outer.put()
        else:
            outer = TestP.build_key(pp).get()
            outer.read()
            if self.request.get('edit'):
                outer.tests1 = [TestA(name='zoobar1', gaa=2, _sequence=10)]
                outer.put()
        self.out_json([outer.tests2.value._properties, outer])


class Test2(BaseTestHandler):
    def respond(self):
        import PIL
        import sys

        self.out_json([sys.version, sys.version_info, sys.path])
        #self.out_json(copy.copy(sys.modules))


for k, o in globals().items():
    if inspect.isclass(o) and issubclass(o, BaseTestHandler):
        handler.register(('/Tests/%s' % o.__name__, o))
コード例 #2
0
ファイル: api.py プロジェクト: miraclestyle/miraclestyle
class Install(handler.Angular):
  
  def respond(self):
    out = []
    for model, action in [('15', 'update'), ('17', 'update'), ('19', 'update_unit'), ('19', 'update_currency')]:
      out.append(io.Engine.run({'action_model' : model, 'action_id' : action}))
    return out
    
  def after(self):
    if not self.data:
       self.data = {}
       
    self.send_json(self.data)
      
class Endpoint(handler.Angular):
 
  def respond(self):
    output = io.Engine.run(self.get_input())
    return output
    
  def after(self):
    if not self.data:
       self.data = {}
       
    self.send_json(self.data)
 
 
handler.register(('/endpoint', Endpoint),
                 ('/install', Install),
                 ('/reset', Reset),)
コード例 #3
0
ファイル: auth.py プロジェクト: miraclestyle/miraclestyle
    if provider is None:
       provider = 'google'
    data = self.get_input()
    data['login_method'] = provider
    data.update({
                 'action_model' : '0',
                 'action_id' : 'login',   
                })
    output = io.Engine.run(data)  
    if 'authorization_code' in output:
        self.response.set_cookie('auth', output.get('authorization_code'), httponly=True)
    return output
  
 
class Logout(handler.Angular):
    
  def respond(self):
    data = self.get_input()
    data.update({
                 'action_model' : '0',
                 'action_key' : 'logout',   
               })
    output = io.Engine.run(data)
    self.response.delete_cookie('auth')
    return output
            
    
handler.register((r'/login', Login, 'login'),
                 (r'/login/<provider>', Login, 'login_provider'),
                 (r'/apps', handler.AngularBlank, 'apps'), 
                 (r'/logout', Logout, 'logout'))
コード例 #4
0
# -*- coding: utf-8 -*-
'''
Created on May 29, 2014

@author:  Edis Sehalic ([email protected])
'''
from app import util, io
from webclient import handler


class IOEngineCronRun(handler.Base):
    def respond(self, action_id):
        util.log('Begin IOEngineCronRun execute')
        io.Engine.run({'action_model': '83', 'action_id': action_id})
        util.log('End IOEngineCronRun execute')


handler.register(('/cron/<action_id>', IOEngineCronRun, 'io_engine_cron_run'))
コード例 #5
0
# -*- coding: utf-8 -*-
'''
Created on Feb 17, 2014

@author:  Edis Sehalic ([email protected])
'''
from app import util, io
from webclient import handler


class IOEngineRun(handler.Base):
    def respond(self):
        util.log('Begin IOEngineRun execute')
        input = self.get_input()
        io.Engine.run(input)
        util.log('End IOEngineRun execute')


handler.register(('/task/io_engine_run', IOEngineRun, 'io_engine_run'))
コード例 #6
0
ファイル: domain.py プロジェクト: miraclestyle/miraclestyle
# -*- coding: utf-8 -*-
'''
Created on Mar 11, 2014

@author:  Edis Sehalic ([email protected])
'''
from webclient import handler

from app import io
 
handler.register((r'/app/<app_id>', handler.AngularBlank, 'app_view'),
                 (r'/app/<app_id>/search/<kind>/<filter>', handler.AngularBlank, 'app_view_search'))
コード例 #7
0
# -*- coding: utf-8 -*-
'''
Created on Feb 26, 2014

@author:  Edis Sehalic ([email protected])
'''
from webclient import handler
    
handler.register((r'/admin/search/<kind>/<filter>', handler.AngularBlank, 'admin'))
コード例 #8
0
ファイル: ui.py プロジェクト: miraclestyle/miraclestyle
import json

from app import io

from webclient import handler


class ModelInfo(handler.Base):
    def respond(self):

        # beside the content type include the cache headers in the future
        self.response.headers['Content-Type'] = 'text/javascript'

        models = io.Engine.get_schema()
        send = {}
        for kind, model in models.items():
            if kind:
                try:
                    int(kind)
                    send[kind] = model
                except:
                    pass

        script = u"KINDS = {}; \n"
        script += u'KINDS.info = %s;' % handler.output_json(send)

        self.response.write(script)


handler.register(('/', handler.AngularBlank), ('/model_info.js', ModelInfo))