/[theodore]/snips/snips/snips.pyc


UCC Code Repository

Contents of /snips/snips/snips.pyc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 48 - (show annotations) (download) (as text)
Sat Jun 28 09:58:29 2008 UTC (12 years, 9 months ago) by theodore
File MIME type: application/octet-stream
File size: 15722 byte(s)
add stuff before drunken code


1
2 ÒïeHc@s>dkZdkZdkZdkZdklZdklZeii ddƒdk
3 Z
4 dk Z dk l Z dk lZlZlZdklZdklZeid=eiƒZeid ƒeid
5 d ƒZeid
6 d ƒZeid
7 d ƒZeid
8 d
9 ƒZdZd„Zd„Zd„Zdd„Z e!d„Z"d„Z#d„Z$dgd„Z%dd„Z&gd„Z'd„Z(d„Z)ddd„Z*d„Z+dd „Z,d!„Z-d"„Z.dd#„Z/d$„Z0d%„Z1dd&„Z2d'„Z3d(„Z4d)„Z5d*„Z6d+„Z7d,„Z8d-„Z9d.„Z:dS(/N(ssys(sjoinis ./modules(s highlight(s guess_lexersget_all_lexerssget_lexer_by_name(s HtmlFormatter(sTemplates ./snips.cfgtdatabasetusertpasswordthostnamesContent-Type: text/html
10
11 cCs>tddddƒ}|iƒ}d}d}t||ƒdS(Ntfilenamestemplates/home.txttmodule_directorys
12 ./tmp/makosSnips Homepage(tTemplatet
13 mytemplatetrendertmaintheaderttitlet
14 print_page(R RR
15 R (([email protected]/home/ucc/theodore/public-html/svn/theodore/snips/snips/snips.pyt display_home!s
16  cCsbtddddƒ}|iddddd tƒd
17 dd dd d ddƒ}td|dƒdS(NRstemplates/form.txtRs
18 ./tmp/makotactiontnewttagstt languagest descriptiontcodetsubmits And Save ItthiddensSnips - Create new snipsCreate new snip(RRRt get_languagesR R (R R((R tnew_snip(s9c CsÞt|ƒ\}}}}}}|gjo|idƒnt |dƒ}t
19 ddddƒ}|i ddd |d
20 t |ƒd |d |d ddd|fƒ}
21 d|} | dti|ƒ|f}t| |
22 |ƒdS(NtNonet Rstemplates/form.txtRs
23 ./tmp/makoRteditRRRRRs Save ChangesRs7<input type="hidden" name="snip_id" value="%s"></input>sEditing snip - %ss1, last saved %s - <a href='?editsnip=%s'>edit</a>(tget_sniptindextsnip_idRRtlanguaget timesavedRtappendtjoinRRRRR R ttimetctimeR
24 R ( RRRR R!RR
25 RRR R ((R t edit_snip-s C
26 RcCs¤g}d}x<tƒD]1}|d}|dd}|i||fƒqW|iƒxH|D]@\}}d}||jo
27 d}n|d|||f7}q\W|S(Ns$<option value="guess">Guess</option>iiRsselected="selected"s!<option value="%s" %s>%s</option>(
28 tlexerstlisttget_all_lexerstlexertnametaliasR"tsorttselectedR (R R.R+R*R(R,R'((R R=s
29 
30 
31   
32 cCsY|o!y tƒ}Wq.d}q.Xnd}tddddƒ}|id|ƒ}|S(NRRstemplates/sidebar.txtRs
33 ./tmp/makottagcloud(tsidebart get_tagcloudR/RRR(R0R/R((R R0Ls c CsLy(tidtdtdtdtƒaWntdƒnXtiƒatS(NthostRtpasswdtdbsDatabase connection problem( tMySQLdbtconnecttdb_hosttdb_usert db_passwordt db_databasetconnt print_errortcursor(((R tdbh_openXs( cCs"tiƒtiƒtiƒdS(N(R=tcloseR;tcommit(((R t dbh_closebs
34 
35 cCstƒ}|id|||tiƒfƒ|idƒ|iƒd}t |ƒ}x$|D]}|id||fƒq[Wt ƒt |ƒdS(NsYINSERT INTO snips_snip (code, description, language, timesaved) VALUES (%s, %s, %s, %s); sSELECT LAST_INSERT_ID();is7INSERT INTO snips_tags (snip_id, tag) VALUES (%s, %s); (R>R=texecutetsnipRR R$tfetchoneRtintRttagRAtredirect(RCRR RR=RRF((R tsubmit_new_snipgs "  RCcCsd||fGHdS(Ns:Status: 303 Moved Permanently
36 Location: ./index.cgi?%s=%s
37 (tpagetid(RJRI((R RGsscCstƒ}|id|||tiƒ|fƒ|id|fƒ|id|fƒx$|D]}|id||fƒq[Wt
38 ƒt |ƒdS(Ns`UPDATE snips_snip SET code = %s, description = %s, language = %s, timesaved = %s WHERE id = %s; s¡INSERT INTO snips_story (snip_id, code, description, language, timesaved) SELECT id, code, description, language, timesaved FROM snips_snip ss WHERE ss.id = %s; s+DELETE FROM snips_tags WHERE snip_id = %s; s7INSERT INTO snips_tags (snip_id, tag) VALUES (%s, %s); ( R>R=RBRRR R$RRRFRARG(RRRR RRFR=((R tupdate_current_snipws %c
39 Cs›tƒ}|id|fƒ|iƒ\}}}}}|id|fƒ|i
40 ƒ} g}x| D]}|i|dƒqcWtƒ||||||fS(NsQSELECT id, code, description, language, timesaved FROM snips_snip WHERE id = %s; s/SELECT tag FROM snips_tags WHERE snip_id = %s; i(R>R=RBRRDRRRR R!tfetchallt tupletagsRttupleR"RA(
41 RRRR R!RR=RNRRM((R Rƒs  c Csãt|ƒ\}}}}}}|gjo|idƒnt |dƒ}t
42 ||ƒ}t |ƒ} t ddddƒ}|id|d|d |d
43 | d |ƒ} d |}
44 |
45 d ti|ƒ||f}t|
46 | |ƒdS(NRs, Rs./templates/snip.txtRs
47 ./tmp/makoRRRCR tsnipidsViewing snip - %ssY, last saved %s - <a href='?editsnip=%s'>edit</a> | <a href='?snipstory=%s'>snipstory</a>(RRRRRR R!RR"R#t format_codet get_longnamet languagenameRRRR R R$R%R
48 R ( RRRR R!RRR
49 RRRR R ((R t
50 print_snips  *
51  RcCsDyt|ƒ}Wn-yt|ƒ}[email protected]tdƒ}[email protected]XnX|S(Nttext(tget_lexer_by_nameR tmylexert guess_lexerR(R RRV((R t get_lexer¢scCstid|ƒ}|S(Ns\s*(tretsplitR(R((R ttagify­sc Csh|djo
52 |}ntddddƒ}tGH|id|d|dtƒd |ƒGHti d
53 ƒdS( NRRs./templates/main.txtRs
54 ./tmp/makoR R
55 R0R i(
56 R
57 R RRt html_headerRR0R tsystexit(R R R
58 R((R R ´s  
59 &c Csed}||}d|d}tddddƒ}tGH|id|d |d
60 ttƒd |ƒGHdS( Ns Snips - errorsh<div id="error"><em>An error has occurred processing your request please review the errors below</em><p>s
61 </p></div>Rs./templates/main.txtRs
62 ./tmp/makoR R
63 R0R ( R terrorR
64 RRR\RR0tFalse(R_R R
65 R((R R<½s 
66 cCs=tdƒ}tddddƒ}|id|ddƒ}|S( NiRstemplates/cloud.txtRs
67 ./tmp/makoRtsizetsmall(tget_tagsRRRRtcloud(RdRR((R R1Æs cCstƒ}|t|ƒjo
68 d}n|djo|id|ƒn3|djo|id|dƒn|idƒ|iƒ}|dd}|dd}t |ƒ}xXt
69 t |ƒƒD]D}||\}}|t||d||ddƒf||<qÀW|iƒtƒ|S( NiisRSELECT tag, COUNT(*) FROM snips_tags GROUP BY tag ORDER BY COUNT(*) DESC LIMIT %s;iÿÿÿÿsISELECT tag, COUNT(*) FROM snips_tags GROUP BY tag ORDER BY COUNT(*) DESC;if1.0i (R>R=tlimitRERBRLRtmaxtminR(trangetlentiRFtcountR-RA(ReRkRRfRgR=RjRF((R RcÌs& 
70      2
71 cCsSd}tƒ}tddddƒ}|id|ddƒ}d }t||ƒdS(
72 NRRstemplates/cloud.txtRs
73 ./tmp/makoRRatbigsSnips - Showing all tags( RdRcRRRRR R R (RR RR Rd((R t show_all_tagsâs  cCsLtƒ}|idƒ|iƒ}tƒt|ƒ}d}t ||ƒdS(NscSELECT id, code, description, language, timesaved FROM snips_snip ORDER BY timesaved DESC LIMIT 10;sViewing latest 20 snips(
74 R>R=RBRLtsnipsRAtsnips_to_snippetsR R R (R RnR=R ((R t latest_snipsìs    cCs[|djp |djodSnx2tƒD]'}|dd|jo |dSq,q,W|S(NRtguesss
75 None Givenii(R R)R*(R R*((R RQ÷s
76 cCsVtƒ}|id|fƒ|iƒ}tƒt|ƒ}d|}t
77 ||ƒdS(NsSELECT ss.id, ss.code, ss.description, ss.language, ss.timesaved FROM snips_snip ss, snips_tags st WHERE st.tag = %s AND st.snip_id = ss.id; sViewing all snips tagged '%s'( R>R=RBRFRLRnRARoR R R (RFR RnR=R ((R tview_tagÿs   
78 c CsÐd}
79 xÃ|D]»}|\}}}}}t}t
80 |ƒdjo|d }t }nt |ƒ} t||ƒ}ti|ƒ}tddddƒ}|
81 |id|d|d |d
82 | d |d |ƒ7}
83 q W|
84 S( NRiôRs./templates/snippet.txtRs
85 ./tmp/makoRRCtedittimeR ROtviewmore(R RnRCRRRR R!R`RtRitTrueRQRRRPR$R%RRR( RnR!RRtRR RCRRRRR ((R Ro
86 s
87 
88  8cCsjtƒ}|id|fƒ|iƒ}|id|fƒ|iƒ} tƒt | ƒ} | i
89 d|ƒd} d}t | ƒ} tddddƒ}x¡| D]™}| |}
90 |\}}} }}t|ƒ}t||ƒ}ti|ƒ}| |id | d
91 |d |d |d |d|d| d|ƒ7} |d7}qžWd|}|d|f}t || |ƒdS(NsOSELECT 0, code, description, language, timesaved FROM snips_snip where id = %s;szSELECT id, code, description, language, timesaved FROM snips_story where snips_story.snip_id = %s ORDER BY timesaved DESC;iRRs./templates/snipstory.txtRs
92 ./tmp/makoRRCRsR ROt snipstoryidttotalRkisSnipstory of snip %ss" - <a href='?editsnip=%s'>edit</a>(!R>R=RBRORDt
93 latestsnipRLRnRAR(tinsertR RjRit
94 totalsnipsRRRCtversionRJRRR R!RQRRRPR$R%RR R
95 R (ROR!RRRCR
96 RJR RxRzR{R RRnR RjR=RR((R tprint_snipstorys0     
97  @
98 cCs:t||ƒ}tdtddƒ}t|||ƒ}|S(Ntlinenostcssclasstsource(RXR RR*t HtmlFormatterRut formattert highlight(R RR*R((R RP:scCsPtƒ}|id|fƒ|idtiƒ||fƒtƒt|ƒdS(Ns¡INSERT INTO snips_story (snip_id, code, description, language, timesaved) SELECT id, code, description, language, timesaved FROM snips_snip ss WHERE ss.id = %s; s«UPDATE snips_snip ss, snips_story st SET ss.code = st.code, ss.description = st.description, ss.language = st.language, ss.timesaved = %s WHERE ss.id = %s AND st.id = %s; (R>R=RBRR$tto_idRARG(RRƒR=((R t [email protected]s
99  c Cst|ƒ\}}}}}}|gjo|idƒnt |dƒ}t
100 ||ƒ}t |ƒ} t ddddƒ}|id|d|d |d
101 | d |ƒ} d |}
102 |
103 d ti|ƒ||f}t ddddƒ}| |iddd |ƒ7} t|
104 | ƒdS(NRs, Rs./templates/snip.txtRs
105 ./tmp/makoRRRCR ROsAdd comment about snip - %ssY, last saved %s - <a href='?editsnip=%s'>edit</a> | <a href='?snipstory=%s'>snipstory</a>stemplates/newcomment.txtRsAdd your 2 cents(RRRRRR R!RR"R#RPRQRRRRRR R R$R%R
106 R ( RRRR R!RRR
107 RRRR R ((R t add_commentJs  *
108  cCsCtƒ}|id|||tiƒfƒtƒt|dƒdS(NsfINSERT INTO snips_comments (snip_id, author, comment, timesaved, flagged) VALUES (%s, %s, %s, %s, 0); t viewcomments( R>R=RBROtauthortcommentR$RARG(ROR‡RˆR=((R tsubmit_comment_s "c Cs1tƒ}|id|fƒ|iƒ}|id|dfƒ|iƒ}tƒt|ƒ} t
109 ddddƒ} t t i ƒ|dƒ}| d 7} xs|D]k}|\}
110 }}} |d
111 d }| | id |
112 d |d|dt i| ƒd|ƒ7} ||d7}qW| d7} d|}t|| ƒdS(NsQSELECT id, code, description, language, timesaved FROM snips_snip WHERE id = %s; s`SELECT id, author, comment, timesaved FROM snips_comments WHERE snip_id = %s AND flagged >= %s; iRstemplates/comment.txtRs
113 ./tmp/makoi{s<div id='container'>iit commentidRˆR‡R!tcoloris</div>s Viewing comments about snip - %s(R>R=RBRORLRntcommentsRARoR RRRER$RkRˆRŠR‡R!R‹RR%R R ( RORkRˆR‡RnR RŒR=R‹RRŠR R!((R t view_commentses&    
114 7
115 
116 (;RYR$R5t ConfigParsertosR]tstringR#tpathRytyamltpygmentsR‚tpygments.lexersRWR)RUtpygments.formattersR€t mako.templateRtconfigtreadtgetR8R9R7R:R\RRR&RRuR0R>RARHRGRKRRSRXR[R R<R1RcRmRpRQRrRoR|RPR„R…R‰R(1R9RWRRQR<R“R‰RRR0R)RGRoR’R1R&R\RRAR8R|R>R[R€R—RHRrRPR…R RKRUR]RmRcRRYRRŽR„R#R:RXRpR5R7RSR$R‚((R t?sf           
117       
118      
119    
120  

Properties

Name Value
svn:mime-type application/octet-stream

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26