def _check_state(self, expertid): expert = expert_db_handle.GetExpertInstanceById(expertid) if expert.state == 'waitfor_check': self.page_title = u"个人信息(审核中,禁止修改)" elif expert.state == 'approved': self.page_title = u"个人信息(审核通过)" return True
def action(self, request, obj_id): self.current_past_action = 1 expert = expert_db_handle.GetExpertInstanceById(obj_id) if not expert: return result = keystone_approve_expert(request, expert) if result: result = expert_db_handle.CheckExpertInfo(expert) if result: self.current_past_action = 0
def wrapper2(self, *args, **kwargs): expertid = self.kwargs.get('expertid', None) if not expertid: raise exceptions.NotAuthorized("Missing Expert ID") expert = expert_db_handle.GetExpertInstanceById(expertid) if not expert: raise exceptions.NotAuthorized("Invalid Expert ID") if not expert.state in expected_states: raise exceptions.NotAuthorized("Illegal Expert state") return func(self, *args, **kwargs)
def FillContextByexpertid(context, expertid): expert_dict = expert_db_handle.GetExpertInstanceById(expertid, returnDict=True) if not expert_dict: messages.error(self.request, u"无法查询到该ID(%s)的专家记录" % expertid) return for key in expert_dict: context[key] = expert_dict[key] rst = expert_db_handle.GetAllExpertTitle(expertid) context["rencaichenghaos"] = rst rst = expert_db_handle.GetAllExpertClass(expertid) context["zhuanjialeixings"] = rst rst = expert_db_handle.GetAllExpertDomain(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTDOMAINFIELDS, 'domainserial', project_workflows.MAX_EXPERTDOMAIN_SLICES) rst = expert_db_handle.GetAllFormalJob(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTFORMALJOBFIELDS, 'formaljob_serial', project_workflows.MAX_EXPERTFORMALJOB_SLICES) rst = expert_db_handle.GetAllEducation(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTEDUCATIONFIELDS, 'education_serial', project_workflows.MAX_EXPERTEDUCATION_SLICES) rst = expert_db_handle.GetAllPartTimeJob(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTPARTTIMEJOBFIELDS, 'parttimejob_serial', project_workflows.MAX_EXPERTPARTTIMEJOB_SLICES) rst = expert_db_handle.GetAllReviewHistory(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTREVIEWHISTORYFIELDS, 'reviewhistory_serial', project_workflows.MAX_EXPERTREVIEWHISTORY_SLICES) rst = expert_db_handle.GetAllXiangmuInfo(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTXIANGMUINFOFIELDS, 'xiangmuinfo_serial', project_workflows.MAX_EXPERTXIANGMUINFO_SLICES) rst = expert_db_handle.GetAllAttachment(expertid, returnDict=True) extract_fields_from_list(context, rst, project_workflows._EXPERTATTACHMENTFIELDS, 'attachment_serial', project_workflows.MAX_EXPERTATTACHMENT_SLICES)
def get_initial(self): initial = super(CommentExpertReviewView, self).get_initial() projectid = self.kwargs['projectid'] expertid = self.kwargs['expertid'] project = project_db_handle.GetProjectInstanceById(projectid) expert = expert_db_handle.GetExpertInstanceById(expertid) initial['projectid'] = projectid initial['projectname'] = project.projectname initial['expertid'] = expertid initial['expertname'] = expert.expertname return initial
def action(self, request, obj_id): self.current_past_action = 1 expert = expert_db_handle.GetExpertInstanceById(obj_id) if not expert: return result = keystone_delete_account(request, expert) if not result: return result = expert_db_handle.DeleteExpertRecord(expert) if result: self.current_past_action = 0
def action(self, request, obj_id): self.current_past_action = 1 expert = expert_db_handle.GetExpertInstanceById(obj_id) if not expert: return new_user = keystone_create_account(request, expert) if not new_user: return result = expert_db_handle.AccountCreated(expert, new_user) if result: self.current_past_action = 0
def __init__(self, request=None, context_seed=None, entry_point=None, *args, **kwargs): super(DetailExpertRecord, self).__init__(request=request, context_seed=context_seed, entry_point=entry_point, *args, **kwargs) expertid = expert_db_handle.get_expertid_from_keystone_user( request, redirect=self.success_url) expert = expert_db_handle.GetExpertInstanceById(expertid) if expert and expert.state not in ['draft']: self.disable_finalize_button = True
def get_initial(self): initial = super(ViewReviewResultView, self).get_initial() projectid = self.kwargs['projectid'] expertid = self.kwargs['expertid'] project = project_db_handle.GetProjectInstanceById(projectid) expert = expert_db_handle.GetExpertInstanceById(expertid) initial['projectid'] = projectid initial['projectname'] = project.projectname initial['expertid'] = expertid initial['expertname'] = expert.expertname reviewer = project_db_handle.GetReviewerInstanceById( project, expertid, project_expected_states=['start_review', 'finished'], reviewer_expected_states=[REVIEWER_SELECTED]) initial['comments'] = reviewer.comments initial['comments_attachments'] = reviewer.comments_attachments initial['comments_on_comments'] = reviewer.comments_on_comments return initial
def _check_state(self, expertid): expert = expert_db_handle.GetExpertInstanceById(expertid) if expert.state != 'draft': raise exceptions.NotAuthorized("Illegal Visiting") return True