当前位置: 首页>>代码示例>>Python>>正文


Python logging.loginfo函数代码示例

本文整理汇总了Python中backend.logging.loginfo函数的典型用法代码示例。如果您正苦于以下问题:Python loginfo函数的具体用法?Python loginfo怎么用?Python loginfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了loginfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: change_member

def change_member(request, stugroup_form, origin):
    student_id = stugroup_form.cleaned_data["student_id"]
    student_name = stugroup_form.cleaned_data["student_name"]
    try:
        project = ProjectSingle.objects.get(student__user_id=request.user)
    except:
        raise Http404

    group = project.student_group_set
    managerid=StudentProfile.objects.get(id=project.student_id) #得到负责人的信息
    teammanager = User.objects.get(id=managerid.user_id)
    if filter(lambda x:x==student_id, [student.studentId for student in group.all()]):
        return {'status': '1', 'message': u"替换成员已存在队伍中,请选择删除"}

    loginfo(p=teammanager.first_name,label="teammanager.first_name")
    loginfo(p=student_name,label="student_name")    
    for student in group.all():
        if student.studentId == origin:
            # 如果是更改负责人的信息时需要将first_name内容更新
            if  student.studentName == teammanager.first_name:
                teammanager.first_name = student_name
            student.studentName = student_name
            student.studentId = student_id
            student.save()
            table = refresh_member_table(request)
            ret = {'status': '0', 'message': u"人员变更成功", 'table':table}
            break
    else: # new student
        ret = {'status': '1', 'message': u"输入有误,请刷新后重新输入"}
    return ret
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:30,代码来源:ajax.py

示例2: info_result_xls

def info_result_xls(request,project_list):
    """
    """
    # def _format_index(i):
    #     i = str(i)
    #     i = '0' * (3-len(i)) + i
    #     return i

    def _format_number(i):
        i = str(i)
        i = '0' * (4-len(i)) + i
        return i

    # name_code = '2013' + request.user.username
    # loginfo(p=teammanager.first_name, label="get first_name")
    # school_prof = SchoolProfile.objects.get(userid=request.user)
    proj_set = project_list
    xls_obj, workbook = info_xls_province_gen()

    # _index = 1
    _number= 1
    for proj_obj in proj_set:
        teammember = get_studentmessage(proj_obj)       

        pro_type = PreSubmit if proj_obj.project_category.category == CATE_INNOVATION else PreSubmitEnterprise
        fin_type = ("15000", "5000", "10000") if proj_obj.financial_category.category == FINANCIAL_CATE_A else ("10000", "0", "10000")
        try:
            innovation = pro_type.objects.get(project_id=proj_obj.project_id)
        except Exception, err:
            loginfo(p=err, label="get innovation")
            loginfo(p=proj_obj.project_category.category, label="project category")
        # if _index==1:
        #     schoolname = proj_obj.school
        #     name_code = get_shcoolcode(schoolname)
        # if schoolname!=proj_obj.school:
        #     _index=1
        #     schoolname = proj_obj.school
        #     name_code = get_shcoolcode(schoolname)   

        row = 4 + _number
        xls_obj.write(row, 0, "%s" % _format_number(_number))
        xls_obj.write(row, 1, unicode(proj_obj.school))
        xls_obj.write(row, 2, unicode(proj_obj.project_code))
        xls_obj.write(row, 3, unicode(proj_obj.title))
        xls_obj.write(row, 4, unicode(proj_obj.financial_category))
        xls_obj.write(row, 5, unicode(proj_obj.project_category))
        xls_obj.write(row, 6, unicode(teammember['manager_name']))# 负责人
        xls_obj.write(row, 7, unicode(teammember['manager_studentid'])) # 学号
        xls_obj.write(row, 8, unicode(teammember['member_number'])) # 学生人数
        xls_obj.write(row, 9, unicode(teammember['othermember'])) # 项目其他成员
        xls_obj.write(row, 10, unicode(proj_obj.inspector))
        xls_obj.write(row, 11, unicode(proj_obj.inspector_title)) # 指导老师职称
        xls_obj.write(row, 12, fin_type[0]) # 经费
        xls_obj.write(row, 13, fin_type[1]) # 经费
        xls_obj.write(row, 14, fin_type[2]) # 经费
        xls_obj.write(row, 15, unicode(proj_obj.insitute))
        xls_obj.write_merge(row, row, 16, 18, unicode(innovation.proj_introduction)) # both enterprise and innovation has innovation attr

        # _index += 1
        _number+= 1
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:60,代码来源:utility.py

示例3: ProjInsituteChange

def ProjInsituteChange(request, cate):
    try:
        project = ProjectSingle.objects.get(student__user=request.user)
        new_cate = InsituteCategory.objects.get(category=cate)
    except Exception, err:
        loginfo(p=err, label="change project insitute")
        raise Http404
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:7,代码来源:ajax.py

示例4: refreshObjectAlloc

def refreshObjectAlloc(request, object):

    if object == "special":

        user_special_info = {}
        for i in SchoolProfile.objects.all():
            user_special_info[i] = []
        for i in Special.objects.all():
            if i.school_user:
                user_special_info[i.school_user].append(i.name)
        instance = {
            'object_name':object,    
            'object_chinese_name':'专题',
            'user_object_info':user_special_info,
        }
        return render_to_string("adminStaff/widgets/object_alloc.html", {'instance': instance})
    elif object == "college":
        user_college_info = {}

        for i in CollegeProfile.objects.all():
            user_college_info[i] = []

        for i in College.objects.all():
            if i.college_user:
                user_college_info[i.college_user].append(i.name)
        instance = {
            'object': object,
            'object_chinese_name':'学院',
            'user_object_info':user_college_info,
        }
        return render_to_string("adminStaff/widgets/object_alloc.html", {'instance': instance})

    else:
        loginfo("error in refreshObjectAlloc")
开发者ID:DutBright,项目名称:scientificResearch,代码行数:34,代码来源:ajax.py

示例5: fundBudgetViewWork

def fundBudgetViewWork(request,pid,is_submited,redirect=False):
    fundbudget = ProjectFundBudget.objects.get(project_id = pid)
    project = ProjectSingle.objects.get(project_id = pid)
    # if fundbudget.finance_staff:finance_staff=fundbudget.finance_staff
    # else:finance_staff="未填写"
    # if fundbudget.finance_checktime:finance_checktime=fundbudget.finance_checktime
    # else:finance_checktime="未填写"
    if request.method == "POST":
        fundbudget_form = ProFundBudgetForm(request.POST, instance=fundbudget)
        fundbudgetremarkment_form = ProFundBudgetRemarkmentForm(request.POST,instance=fundbudget)
        if fundbudget_form.is_valid() and fundbudgetremarkment_form.is_valid():
            fundbudgetremarkment_form.save()
            fundbudget_form.save()
            # redirect = True
            status_confirm(request,project)
            loginfo(p=project.project_status,label="status")
        else:
            logger.info("ProFundBudgetForm Valid Failed"+"**"*10)
            logger.info(fundbudget_form.errors)
            logger.info(fundbudgetremarkment_form.errors)
    else:
        fundbudget_form = ProFundBudgetForm(instance=fundbudget)
        fundbudgetremarkment_form=ProFundBudgetRemarkmentForm(instance=fundbudget)
    context = {
        'redirect':redirect,
        'fundbudget_form':fundbudget_form,
        'fundbudgetremarkment_form':fundbudgetremarkment_form,
        'pid':pid,
        'is_submited':is_submited,
        'projectbudget':project.project_budget_max,
        'project':project,
        'fundbudget':fundbudget,
        'showseal':project.project_status.status>=PROJECT_STATUS_TASK_FINANCE_OVER,
    }
    return context
开发者ID:DutBright,项目名称:scientificResearch,代码行数:35,代码来源:views.py

示例6: __init__

 def __init__(self,*args,**kwargs):
     request  = kwargs.get("request",None)
     if request != None:
         del kwargs['request']
     super(ScheduleBaseForm, self).__init__(*args, **kwargs)
     if request != None:
         identity = request.session.get('auth_role', "")
         if identity == SCHOOL_USER:
             obj_list = Special.objects.filter(school_user__userid = request.user)
             choice_list=[]
             choice_list.append((-1,"专题类型"))
             for obj in obj_list:
                 choice_list.append((obj.id, obj.name))
             obj_choice = tuple(choice_list)
             loginfo(obj_choice)
             self.fields["special"].choices = obj_choice
         elif identity == COLLEGE_USER:
             obj_list = College.objects.filter(college_user__userid = request.user)
             choice_list=[]
             choice_list.append((-1,"学院"))
             for obj in obj_list:
                 choice_list.append((obj.id, obj.name))
             obj_choice = tuple(choice_list)
             self.fields["college"].choices = obj_choice
             college_status_choices=get_status_choice()
             college_status_choices = tuple( [(-1, u"项目状态")] + college_status_choices)
             self.fields["status"].choices=college_status_choices
开发者ID:DutBright,项目名称:scientificResearch,代码行数:27,代码来源:forms.py

示例7: show_index_get_search_context

def show_index_get_search_context(request, project_page,new_show = False):
    search_school = request.GET.get('search_school') or ""
    search_year = request.GET.get('search_year') or ""
    search_grade = request.GET.get('search_grade') or ""
    search_keywords=request.GET.get('search_keywords') or ""
    pro_type = ShowProjectSingle if new_show else ProjectSingle
    
    q1 = (search_year and Q(year=search_year)) or None
    q2 = (search_school and Q(school=search_school)) or None
    q3 = (search_grade and Q(project_grade=search_grade)) or None
    q4 = (search_keywords and  (Q(keywords__icontains=search_keywords) | \
            Q(title__icontains=search_keywords) | Q(background__icontains=search_keywords) \
            | Q(result_overview__icontains=search_keywords))) or None
    qset = filter(lambda x: x != None, [q1, q2, q3,q4])
    loginfo(p=q4, label="in q4")
    loginfo(p=qset, label="in qset")
    if qset:
        qset = reduce(lambda x, y: x & y, qset)
        project_list = pro_type.objects.filter(qset)
    else:
        project_list = pro_type.objects.all()

    context = getContext(project_list, project_page, 'project', page_elems=9)
    context["search_school"] = search_school
    context["search_year"] = search_year
    context["search_grade"] = search_grade

    return context
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:28,代码来源:views.py

示例8: MemberChangeInfo

def MemberChangeInfo(request, form, origin):
    loginfo(p=origin, label="origin")
    try:
        project = ProjectSingle.objects.get(student__user_id=request.user)
    except:
        raise Http404
    stugroup_form = StudentGroupInfoForm(deserialize_form(form))
    loginfo(p=stugroup_form, label="stugroup_form")
    if not stugroup_form.is_valid():
        ret = {'status': '1',
               'message': u"输入有误,请重新输入"}
    else:
        email = stugroup_form.cleaned_data["email"]
        telephone = stugroup_form.cleaned_data["telephone"]
        classInfo = stugroup_form.cleaned_data["classInfo"]
        student_id= stugroup_form.cleaned_data["student_id"]
        group = project.student_group_set
        for student in group.all():
            if student.studentId == origin :
                print "save successfully"
                student.email = email
                student.telephone = telephone
                student.classInfo = classInfo
                student.studentId = student_id
                student.save()
                table = refresh_member_table(request)
                ret = {'status': '0', 'message': u"人员变更成功", 'table':table}
                break
        else:
            ret = {'status': '1', 'message': u"该成员不存在,请刷新页面"}
    return simplejson.dumps(ret)
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:31,代码来源:ajax.py

示例9: achivementChange

def achivementChange(request,form,achivementid,pid,is_submited):

    achivementform = ProjectAchivementForm(deserialize_form(form))
    projectsingle = ProjectSingle.objects.get(project_id=pid)
    finalsubmit = FinalSubmit.objects.get(project_id = projectsingle)
    message=""
    if achivementform.is_valid():
        achivementtitle = achivementform.cleaned_data["achivementtitle"]
        mainmember = achivementform.cleaned_data["mainmember"]
        introduction = achivementform.cleaned_data["introduction"]
        remarks = achivementform.cleaned_data["remarks"]
        achivementtype = achivementform.cleaned_data["achivementtype"]
        achivementtype=AchivementTypeDict.objects.get(achivementtype=achivementtype)
        if achivementid == 0:
            new_achivement = ProjectAchivement(achivementtitle=achivementtitle,mainmember=achivementtitle,introduction=introduction,remarks=remarks,
                achivementtype=achivementtype,project_id=projectsingle)
            new_achivement.save()
            message = u"新的研究成果添加成功"
            loginfo(p=achivementtitle,label="achivementtitle")
        else:
            old_achivement = ProjectAchivement.objects.get(content_id=achivementid)
            old_achivement.achivementtitle = achivementtitle
            old_achivement.mainmember = mainmember
            old_achivement.introduction = introduction
            old_achivement.remarks = remarks
            old_achivement.achivementtype = achivementtype
            old_achivement.save()
            message = u"修改成功"
    else:
        logger.info("achivementform Valid Failed"+"**"*10)
        logger.info(achivementform.errors)
        message = u"数据没有填完整,请重新填写"
    table = refresh_achivement_table(request,pid,is_submited) 
    ret={'table':table,'message':message,}
    return simplejson.dumps(ret)
开发者ID:DutBright,项目名称:scientificResearch,代码行数:35,代码来源:ajax.py

示例10: AllocEmail

def AllocEmail(request,form,param):
    form = EmailForm(deserialize_form(form),request=request)
    if form.is_valid():
        try:
            if param in TYPE_ALLOC:
                proj_list = ProjectSingle.objects.filter(Q(project_special=form.cleaned_data['special']) & Q(project_status__status = PROJECT_STATUS_APPLICATION_EXPERT_SUBJECT))
            elif param in TYPE_FINAL_ALLOC:
                proj_list = ProjectSingle.objects.filter(Q(project_special=form.cleaned_data['special']) & Q(project_status__status = PROJECT_STATUS_FINAL_EXPERT_SUBJECT))
            else:
                raise ValueError('')
        except:
            return simplejson.dumps({ 'status':'2', 'message':u"发送失败"})
        if 1:
            recipient_list=[]
            expert_group=[]
            for project in proj_list:
                print project
                p_e_group=Re_Project_Expert.objects.filter(project=project)
                expert_group.extend([item.expert for item in p_e_group])
            loginfo(len(expert_group))
            expert_group=list(set(expert_group))
            loginfo(len(expert_group))
            recipient_list.extend([item.userid.email for item in expert_group])
            send_mail(form.cleaned_data["mail_title"],form.cleaned_data["mail_content"],settings.DEFAULT_FROM_EMAIL,recipient_list)
            return simplejson.dumps({ 'status':'1', 'message':u"专家发送完成"})
    else:
        return simplejson.dumps({ 'status':'0', 'message':u"发送失败",'table':refresh_alloc_email_form(form)})
开发者ID:DutBright,项目名称:scientificResearch,代码行数:27,代码来源:ajax.py

示例11: allocObject

def allocObject(request, object, user, alloced):

    filter_user = user
    if object == "special":
        user = SchoolProfile.objects.filter(userid__username = filter_user)[0]
    elif object == "college":

        user = CollegeProfile.objects.filter(userid__username = filter_user)[0]
    else:
        loginfo("error in allocObject")

    Object = getObject(object)
    objs = Object.objects.all()
    for o in objs:
        if object == "special":
            if alloced.count(o.name):
                o.school_user = user
            elif o.school_user == user:
                o.school_user = None
            o.save()
        elif object == "college":
            if alloced.count(o.name):
                o.college_user = user
            elif o.college_user == user:
                o.college_user = None
            o.save()
        else:
            loginfo("error in allocObject")


    return simplejson.dumps({'status':'1' ,
        'object_alloc': refreshObjectAlloc(request, object),
        'object_table': refreshObjectTable(request, object),
        })
开发者ID:DutBright,项目名称:scientificResearch,代码行数:34,代码来源:ajax.py

示例12: login_redirect

def login_redirect(request,identity):
    """
    When the user login, it will decide to jump the according page, in other
    words, school user will be imported /school/ page, if the user have many
    authorities, the system will jump randomly
    """
    #TODO: I will use reverse function to redirect, like school and expert

    
    loginfo(identity)
    if check_auth(request.user,identity):
        loginfo(request.user)
        pass
    else:
        try:
            del request.session['auth_role']
        except:
            pass
        logout(request)
        return HttpResponseRedirect('/identityerror')
    if identity==ADMINSTAFF_USER:
        redirect_url = '/'+identity+'/'+"studentmanage"
    else:
        redirect_url = '/'+identity+'/'+"homepage"
    request.session['auth_role'] = identity
    return HttpResponseRedirect(redirect_url)
开发者ID:EducationAdministrationSystem,项目名称:EducationSystem,代码行数:26,代码来源:views.py

示例13: userauth_settings

def userauth_settings(request):
    """
    The context processor will add user authorities variables
    into all template
    """
    loginfo(request.META['HTTP_USER_AGENT'])
    userauth = {
                "is_adminstaff": False,
                "is_schooler": False,
                "is_colleger":False,
                "is_experter": False,
                "is_teacher": False,
                "is_finance":False,
                }
    auth_choices= {
        "adminStaff":ADMINSTAFF_USER,
        "school":SCHOOL_USER,
        "college":COLLEGE_USER,
        "teacher":TEACHER_USER,
        "expert":EXPERT_USER,
        "finance":FINANCE_USER,
    }
    identity = request.session.get('auth_role', "")
    userauth["user"]=identity
    if identity == ADMINSTAFF_USER and check_auth(user=request.user, authority=ADMINSTAFF_USER):
        userauth["is_adminstaff"] = True
        try:
            userauth["adminstaff"] = AdminStaffProfile.objects.get(userid=request.user)
        except AdminStaffProfile.DoesNotExist, err:
            loginfo(p=err, label="context AdminStaffProfile")
开发者ID:DutBright,项目名称:scientificResearch,代码行数:30,代码来源:context.py

示例14: student_view

def student_view(request):

    try:
        student = get_object_or_404(StudentProfile, user=request.user)
        project = student.projectsingle
    except Exception, err:
        loginfo(p=err, label="student home view")
        raise Http404
开发者ID:School-of-Innovation-Experiment,项目名称:provinceManagement,代码行数:8,代码来源:views.py

示例15: fileUploadManageView

def fileUploadManageView(request, pid, is_submited):
    print "haha"*100
    context = fileUploadManage(request, pid, is_submited)
    context['user'] = "college"
    # is_submited = False
    context['is_submited'] = is_submited
    loginfo(p=context['files'],label="files")
    return render(request, "college/file_upload.html", context)
开发者ID:DutBright,项目名称:scientificResearch,代码行数:8,代码来源:views.py


注:本文中的backend.logging.loginfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。