ó Ö@Qc@s_ddlmZddlmZddlmZddlmZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddl mZmZmZmZeddd d d d ƒZeje je je je jƒd „ƒZd„Zd„Zd„Zd„Zd„Zd„Zeje jƒd„ƒZdS(iÿÿÿÿ(tMySQLGetRequestResult(t HTMLGetData(tHTMLParseError(t DefineModuleN(tlog_infot log_errort log_warningt log_debugtnamet WbBugReporttauthortOracletversions1.0cCsÚd}y‘tjƒ}tjtj|ƒƒ}t|||ƒ}|dkr–d}d|jƒkrw|d}|d=nt|||ƒ}t|ƒnWn<t k rÕ}d}t dd|j j t |ƒfƒnX|S(Nttlog_filesderror|Unknown failure submitting bug report, please proceed through http://bugs.mysql.com/report.phps WB Bug Reports8An error occurred while submitting the request, %s : %s (t cookielibt CookieJarturllib2t build_openertHTTPCookieProcessortlogintkeyst submit_bugtlogoutt ExceptionRt __class__t__name__tstr(tusertpasswordtdatatret_valt cookieJart urlOpenerRte((s..\modules\wb_bug_report_grt.pyt submitBugs     'c Cs$d}yätj|ƒ}|jd|ƒ}|jƒ}tƒ}|j|ƒ|jdkré|jd}d}|j|jƒ}|jdkrÜ|dkrÜt ||jdd|ƒ} | dkrÜ|d| |}qÜn||}nWn3t j k r} d }t d d t | ƒƒnX|S( Nseerror|Unknown error while submitting the bug, please proceed through http://bugs.mysql.com/report.phps http://bugs.mysql.com/report.phpR t|s tsuccessisno_log_submitted: slerror|An error occurred while submitting the report, please proceed through http://bugs.mysql.com/report.phps WB Bug Reports3An error occurred while submitting the request: %s (turllibt urlencodetopentreadRtfeedt result_typetjointresultt attach_fileRtURLErrorRR( topenerRRRtparamstresponsetparsertnew_linet result_datatfile_attach_errorR"((s..\modules\wb_bug_report_grt.pyR>s(     c CsHd}ytji|d6|d6dd6ƒ}|jd|ƒ}|jƒ}tƒ}t|_|jdƒ|jdƒ|jd dgƒ|jd dgƒ|jd dgƒ|jdddgƒ|j |ƒd}t |j ƒdkr |j ddkr d}q nWn3t j k rC}d}tddt|ƒƒnX|S(Ns,error|Unknown error accessing the bug systemtemailRR tdestshttps://dev.mysql.com/login/thtmltbodytdivtidt containertclasstpage_containertpageth1t page_headert mainContentsKerror|Error accessing the bug system, please verify your email and passwordiisLogin SuccessfulsAerror|Error accessing the bug system, check your network settingss WB Bug Reports#Error accessing the bug system: %s (sidR=(R>R?(sidR@(R>RB(sidRC(R&R'R(R)RtTruet quit_on_donet add_path_nodetadd_path_conditioned_nodeR*tlenR-RR/RR( R0RRRR1R2RR3R"((s..\modules\wb_bug_report_grt.pyRks0       cCs|jdƒdS(Nshttps://dev.mysql.com/logout/(R((R0((s..\modules\wb_bug_report_grt.pyR–scCsÂd}d}d}|jddƒ}y5tj||ƒtj|dƒ}|j|tjj|ƒtj ƒ|j ƒt |dƒj ƒ}ddddg} d||fg} t | | ƒ\} } tjd|dƒ} | jd| ƒ| jdtt| ƒƒƒ|j | | ƒ}|j ƒ}tƒ}|j|ƒ|jdkrRd}nd}Wnbtjk rŽ}d}tddt|ƒƒn0tk r½}d}tddt|ƒƒnX|S( Ns.Unknown error attaching log file to bug reportswb.logs wb_log.zips\t/twtrbt MAX_FILE_SIZEt512000t file_descsWorkbench Log Filet file_privatet1tfile_addsAdd filetfiles!http://bugs.mysql.com/bug.php?id=s&files=2s Content-TypesContent-LengthR%R s.Error attaching the log file to the bug reports WB Bug Reports"Error attaching the log file: %s sError getting the log filesError getting the log file: %s (RLRM(RNsWorkbench Log File(RORP(RQsAdd file(treplacetshutiltcopyfiletzipfiletZipFiletwritetostpathtbasenamet ZIP_DEFLATEDtcloseR(R)tencode_multipart_formdataRtRequesttadd_unredirected_headerRRHRR*R+R/RtIOError(R0t bug_numberRRRtlocal_file_namet zip_file_nametnormalized_pathtzip_filetzip_datatfieldstfilest content_typeR:trequestR2RR3R"((s..\modules\wb_bug_report_grt.pyR.œsB"       c Csd}d}g}xP|D]H\}}|jd|ƒ|jd|ƒ|jdƒ|j|ƒqWxp|D]h\}}}|jd|ƒ|jd||fƒ|jdt|ƒƒ|jdƒ|j|ƒqlW|jd|dƒ|jdƒ|j|ƒ}d|} | |fS( Ns----------wb_file_limits s--s)Content-Disposition: form-data; name="%s"R s8Content-Disposition: form-data; name="%s"; filename="%s"sContent-Type: %ss multipart/form-data; boundary=%s(tappendtget_content_typeR,( RhRitLIMITtCRLFtLtkeytvaluetfilenameR:Rj((s..\modules\wb_bug_report_grt.pyR^Þs&    cCstj|ƒdpdS(Nisapplication/octet-stream(t mimetypest guess_type(Rs((s..\modules\wb_bug_report_grt.pyRmôscCs&d}yãtjƒ}tjtj|ƒƒ}|jdƒ}|jƒ}tƒ}t|_ |j dƒ|j dƒ|j ddgƒ|j dƒ|j d dgƒ|j |ƒt |jƒd krè|jd d krèd}qènWn6tk r!}tdd|jjt|ƒfƒnX|S(Nsherror|Unable to connecto through the Bug System, please proceed through http://bugs.mysql.com/report.phpshttp://bugs.mysql.com/index.phpR9R:R;R<tnavtultlitcurrentiis Bugs Homessuccess|s WB Bug Reports4An error occurred while testing conectivity, %s: %s (sidRv(sidRy(RRRRRR(R)RRDRERFRGR*RHR-t BaseExceptionRRRR(RR R!R2RR3R"((s..\modules\wb_bug_report_grt.pyttest_connection÷s(        '(RRt HTMLParserRtwbRR&RRtgrtRTRVRYRtRRRRt ModuleInfotexporttSTRINGtDICTR#RRRR.R^RmR{(((s..\modules\wb_bug_report_grt.pyts$<"-" - +  B