Parent: [7f6519] (diff)

Download this file

views.pyc    55 lines (55 with data), 9.6 kB

ó
ăÎSc@sddlmZddlmZddlmZmZddlmZm	Z	m
Z
mZddlm
Z
ddlmZmZddlmZddlmZdd	lmZmZmZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$m%Z%m&Z&dd
„Z'defd„ƒYZ(d„Z)d„Z*d„Z+d„Z,d„Z-d„Z.d„Z/d„Z0d„Z1dS(i˙˙˙˙(tsettings(treverse(tHttpResponseRedirecttHttpResponse(trendertget_object_or_404trender_to_responsetredirect(tRequestContext(t
simplejsonttimezone(tListView(tminidom(tAnalysisFormtUploadFileFormtImportChoice(	tAnalysist
ConfigurationtInstancetUploadedFiletAnswertMethodologytMethodologyVersiontQuestiontPage(t
xmlMinidomtTrivialJSONEncodertSearchEngineicCsĺ|jdkrvt|jƒ}|jƒr_|jƒ}tjƒ|_|jƒtt	dƒƒSt
|di|d6ƒS|dkrÁttd|ƒ}td|ƒ}t
|di|d6|d6ƒStƒ}t
|di|d6ƒSdS(	NtPOSTt
analysis_listsanalysis/analysis_new.htmltformitpktinstancetanalysis(
tmethodR
Rtis_validtsaveR
tnowtcreatedRRRRR(trequesttanalysis_idRtmodel_instanceR!((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytanalysis_news
	tAnalysisListcBs eZejjdƒZdZRS(s-createdt
analises_list(t__name__t
__module__Rtobjectstorder_bytquerysettcontext_object_name(((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pyR+"scBs—eed|ƒ}|jjj}d|jddUee||ƒƒedƒ}ee	||ƒƒedƒ}e
|di|d6|d6|d6ƒS(	NRsfrom s2.views import search_html_form, instance_list_htmls&Content-Type: text/html; charset=utf-8sanalysis/analysis_detail.htmlR!tanalysis_detailtsearch_html_ui(RRtmethodology_versiontmethodologytentitytactual_entity_apptstrtsearch_html_formtlentinstance_list_htmlR(R'R(R!R7R4R3((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytdetail&scBs{eed|ƒ}|jjj}d|jddUee||ƒƒedƒ}e	|di|d6|d6|jd6ƒS(	NRsfrom s2.views import search_html_form, instance_list_htmls&Content-Type: text/html; charset=utf-8s analysis/analysis_questions.htmlR!R3R5(
RRR5R6R7R8R9R<R;R(R'R(R!R7R3((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytanalysis_questions1s
cCsWttd|ƒ}|jƒddt|jjƒƒ}t|di|d6|d6ƒS(NRidisanalysis/analysis_report.htmlR!ttd_width(RRtcalculate_scoresR;tinstance_settallR(R'R(R!R?((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytanalysis_report<s
cCs'yÖ|jjddƒ}|jjddƒ}|jjddƒ}|jjddƒ}ytjjd|d|ƒ}Wn@tƒ}tjjd|ƒ|_tjjd|ƒ|_nX||_||_	|j
ƒWn-tk
r}tt
ji|jd6ƒƒSXtt
jid	d6|d6ƒƒS(
Ntquestion_idttid_selected_instancetvaluetnotestinstance_idRtresponsetOK(RtgetRR/RR Rtquestiont
value_integerRHR$t	ExceptionRR	tdumpstmessage(R'RDRFRGRHtatex((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytsave_answerEs"			cCsF|jjddƒ}tjjd|ƒ}ttƒjt|ƒƒƒS(Ntid_instanceRERI(	tGETRLRR/tfilterRRtencodetlist(R'RUtanswers((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytget_answersZscBsĐg}|jjddƒ}ejjd|ƒ}|jjjj}g}ejj	d|jjƒ}x|D]}||j
ƒ7}qjW|jjƒ}x|D]}	d}
d}xĽ|	j
jƒD]”}d}
|jdUg}
|jdUeej||
ƒƒ}ej||
ƒ}ejƒ}|
d|dej||
ƒd|d	|d
7}
qźW|	jdU|	jdUi}|	j|d<de|	jƒGH|
|d
<||d<|j|ƒqšWeeƒje|ƒƒƒS(NRURERR5i˙˙˙˙s<a target='_blank' href='s'>'s' on s: (s results)</a><br>RDs
question.id: tdescriptionRG(RVRLRR/R!R5R6R7RRWt	questionstactual_instancetgetInstanceInfot	query_setRBt	eval_textt	eval_siteR9Rtsearch_countt
search_urltsearch__engine_nametreadable_queryteval_descriptiont
eval_valuetidtappendRRRXRY(R'tmetadataRUR R7tlist_of_questionstpagestpagetiRMR\RGtquerytsitestqRcRdtsearch_engine_name((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytget_metadata_s<

:


cCsVttd|ƒ}|j}d|jƒ|jƒd}t|di|d6ddƒS(NRs	<osseval>s
</osseval>sanalysis/export.xmltxmltcontent_typesapplication/xhtml+xml(RRR5tto_xmlR(R'R(RRtmvtexported_xml((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytexportŒs	cCs¤d}|jdkrtt|j|jƒ}|jƒr}|jdjƒ}td|jdƒ}|jƒyßtj	|ƒ}t
ƒ}|jdƒ}t|dj
djjƒ|_|dj
djj|_|dj
d	jj|_|dj
d
jj|_t
ƒ}yt
jjd|jƒ}WnnXtƒ}	tƒ}
|	|
_|jdƒ}tj|dƒ|
_|dj
d
jj|
_|djdƒ}tj|dƒ|	_|dj
djj|	_|
|_tdi|jd6|jjd6ƒ}
t |di|j!ddƒd6|jdd6|d6|d6|d6|
d6ƒSWqqt"k
rm}dt#|ƒ}qqXq}n	tƒ}t$di|d6|d6dt%|ƒƒS(NRERtfiletdocfileRitIdtNametCreatedt	UserLoginRRtNumberRtinitialtuploaded_file_idtnew_uploaded_file_relpathsanalysis/import_file.htmltindents    t	prettyxmltanalysis_on_filetanalysis_on_dbtnew_uploaded_filetimport_choice_formsError parsing uploaded file: sanalysis/upload_page.htmlRRQtcontext_instance(&R"RRtFILESR#treadRR$RtparseStringRtgetElementsByTagNametintt
attributest
firstChildtdataRitnameR&t
user_loginR/RLRRR6RtgetNaturalAttributetnumberR5RR|turlRttoprettyxmlROR9RR(R'RQRtxml_uploadedR‰txmldocR‡tanalysis_xmlRˆtmethodology_on_filetmethodology_version_on_filetmethodology_version_xmltmethodology_xmlRŠRS((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytupload_page”sH
	 					&Q	cCsb|jd}t|jjddƒƒdk}|jjddƒ}|jjddƒ}ttjd|dƒ}|jƒ}WdQXtj|ƒ}|j	d	ƒd
}t
ƒ}	|rË|	j||ƒn|jdj
j|	_tƒ}
|	|
_|j	dƒd
}|r8|
j||ƒttd
d|
jfƒƒS|jdj
j|
_ttdƒƒSdS(NR„t
how_to_importREitimport_methodologytimport_analysist/trRiR}RR3targsR(RRRLtopenRtBASE_DIRRRRŽRRtfrom_xmlR‘R’R“RiRR5RR(R'R„t
always_insertRŁR¤tcontent_fileRšR›RŸRxRRRœ((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pytperform_importŔs(
!			N(2tdjango.confRtdjango.core.urlresolversRtdjango.httpRRtdjango.shortcutsRRRRtdjango.templateRtdjango.utilsR	R
tdjango.views.genericRtxml.domRtformsR
RRtanalysis.modelsRRRRRRRRRt
OSSEval.utilsRRRR*R+R=R>RCRTR[RtRzRĄR­(((sH/media/discoc/Dati/Lavoro/PROSE/Lavoro/OSSEval/OSSEval/analysis/views.pyt<module>s*"@							-		,