<s> """<STR_LIT>""" <EOL> __author__ = "<STR_LIT>" <EOL> __email__ = "<STR_LIT>" <EOL> __version__ = "<STR_LIT>" <EOL> __url__ = "<STR_LIT>" <EOL> __description__ = "<STR_LIT>" <EOL> __category__ = "<STR_LIT>" <EOL> __license__ = "<STR_LIT>" <EOL> __registrytags__ = "<STR_LIT>" <EOL> from Pyblosxom import tools <EOL> from Pyblosxom . tools import pwrap <EOL> tb_good_response = """<STR_LIT>""" <EOL> tb_bad_response = """<STR_LIT>""" <EOL> def verify_installation ( request ) : <EOL> config = request . get_configuration ( ) <EOL> if not '<STR_LIT>' in config : <EOL> pwrap ( "<STR_LIT>" ) <EOL> return True <EOL> def cb_handle ( args ) : <EOL> request = args [ '<STR_LIT>' ] <EOL> pyhttp = request . get_http ( ) <EOL> config = request . get_configuration ( ) <EOL> urltrigger = config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> logger = tools . get_logger ( ) <EOL> path_info = pyhttp [ '<STR_LIT>' ] <EOL> if path_info . startswith ( urltrigger ) : <EOL> response = request . get_response ( ) <EOL> response . add_header ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> form = request . get_form ( ) <EOL> message = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if "<STR_LIT:url>" in form : <EOL> from comments import decode_form <EOL> encoding = config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> decode_form ( form , encoding ) <EOL> import time <EOL> cdict = { '<STR_LIT:title>' : form . getvalue ( '<STR_LIT:title>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : form . getvalue ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : str ( time . time ( ) ) , <EOL> '<STR_LIT>' : form [ '<STR_LIT:url>' ] . value , <EOL> '<STR_LIT:source>' : form . getvalue ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:description>' : form . getvalue ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : pyhttp . get ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:type>' : '<STR_LIT>' <EOL> } <EOL> argdict = { "<STR_LIT>" : request , "<STR_LIT>" : cdict } <EOL> reject = tools . run_callback ( "<STR_LIT>" , <EOL> argdict , <EOL> donefunc = lambda x : x != <NUM_LIT:0> ) <EOL> if isinstance ( reject , ( tuple , list ) ) and len ( reject ) == <NUM_LIT:2> : <EOL> reject_code , reject_message = reject <EOL> else : <EOL> reject_code , reject_message = reject , "<STR_LIT>" <EOL> if reject_code == <NUM_LIT:1> : <EOL> print >> response , tb_bad_response % reject_message <EOL> return <NUM_LIT:1> <EOL> from Pyblosxom . entries . fileentry import FileEntry <EOL> datadir = config [ '<STR_LIT>' ] <EOL> from comments import writeComment <EOL> try : <EOL> import os <EOL> pi = path_info . replace ( urltrigger , '<STR_LIT>' ) <EOL> path = os . path . join ( datadir , pi [ <NUM_LIT:1> : ] ) <EOL> data = request . get_data ( ) <EOL> ext = tools . what_ext ( data [ '<STR_LIT>' ] . keys ( ) , path ) <EOL> entry = FileEntry ( request , '<STR_LIT>' % ( path , ext ) , datadir ) <EOL> data = { } <EOL> data [ '<STR_LIT>' ] = [ entry ] <EOL> cdict [ '<STR_LIT>' ] = ( <EOL> '<STR_LIT>' % form . getvalue ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> writeComment ( request , config , data , cdict , encoding ) <EOL> print >> response , tb_good_response <EOL> except OSError : <EOL> message = '<STR_LIT>' + path_info + "<STR_LIT>" <EOL> logger . error ( message ) <EOL> print >> response , tb_bad_response % message <EOL> else : <EOL> logger . error ( message ) <EOL> print >> response , tb_bad_response % message <EOL> return <NUM_LIT:1> <EOL> return <NUM_LIT:0> </s>
