Ejemplo n.º 1
0
    def post(self, *args, **kwargs):
        print u"create project"
        project_dict = json.loads(self.get_argument(u"data", u"{}"))
        if u"in_progress" in project_dict:
            project_dict.update(in_progress="true")
        else:
            project_dict.update(in_progress="false")

        manager_id = self.current_user_id
        if not manager_id:
            self.send_error(status_code=403)
            return
        project_dict.update(manager_id=manager_id)
        try:
            response = yield ProjectBL.create(project_dict)
        except Exception, ex:
            logging.info("Exc on create project:")
            logging.exception(ex)
            response = dict(message=ex.message)
Ejemplo n.º 2
0
    def post(self, *args, **kwargs):
        print u'create project'
        project_dict = json.loads(self.get_argument(u'data', u'{}'))
        if u'in_progress' in project_dict:
            project_dict.update(in_progress='true')
        else:
            project_dict.update(in_progress='false')

        manager_id = self.current_user_id
        if not manager_id:
            self.send_error(status_code=403)
            return
        project_dict.update(manager_id=manager_id)
        try:
            response = yield ProjectBL.create(project_dict)
        except Exception, ex:
            logging.info('Exc on create project:')
            logging.exception(ex)
            response = dict(message=ex.message)
Ejemplo n.º 3
0
    try:
        yield momoko.Op(conn.execute, query)
    except Exception, ex:
        print ex


@gen.coroutine
def fill_init_data():
    from tests.scientist_data import Scientist
    from scientist.scientist_bl import ScientistBL

    from tests.project_data import Project
    from project.project_bl import ProjectBL

    scientist_data = Scientist.get_scientist()
    print 'Creating init scientists'
    try:
        for k, val in scientist_data.iteritems():
            yield ScientistBL.create(scientist_dict=val, test_mode=True)
    except Exception, ex:
        logging.exception(ex)
        raise

    project_data = Project.get_project()
    print 'Creating init projects'
    try:
        for k, val in project_data.iteritems():
            yield ProjectBL.create(val, test_mode=True)
    except Exception, ex:
        logging.exception(ex)
        raise