diff options
-rw-r--r-- | pastepy.py | 10 | ||||
-rw-r--r-- | templates/paste.tmpl | 10 |
2 files changed, 15 insertions, 5 deletions
@@ -80,9 +80,10 @@ class Paste(object): 'title': settings.pastebin_name, 'header': settings.pastebin_name, 'lexers': self.lexers, - 'default': settings.default, 'nick': c['nick'].value if 'nick' in c else 'Anonymous', - 'remembered': 'nick' in c, + 'syntax': c['syntax'].value if 'syntax' in c else settings.default, + 'remember_me': 'nick' in c, + 'remember_syntax': 'syntax' in c, }))] def preview(self, mp): @@ -125,7 +126,10 @@ class Paste(object): c['nick'] = nick dt = (datetime.datetime.utcnow() + datetime.timedelta(days = 30)) if 'remember_me' in mp else datetime.datetime.utcfromtimestamp(0) c['nick']['expires'] = dt.strftime('%a, %d-%b-%y %H:%M:%S GMT') - headers.append(('Set-Cookie', c['nick'].OutputString())) + c['syntax'] = syntax + dt = (datetime.datetime.utcnow() + datetime.timedelta(days = 30)) if 'remember_syntax' in mp else datetime.datetime.utcfromtimestamp(0) + c['syntax']['expires'] = dt.strftime('%a, %d-%b-%y %H:%M:%S GMT') + headers.append(('Set-Cookie', c.output())) self.start_response('302 Found', headers) return [] diff --git a/templates/paste.tmpl b/templates/paste.tmpl index e0fea2e..f9c9504 100644 --- a/templates/paste.tmpl +++ b/templates/paste.tmpl @@ -10,13 +10,19 @@ #for cat, ls in $lexers <optgroup label="$cat"> #for k, v in $ls - <option value="$v"#if $k == $default# selected="selected"#end if#>$k</option> + <option value="$v"#if $v == $syntax# selected="selected"#end if#>$k</option> #end for </optgroup> #end for </select> + <input type="checkbox" name="remember_syntax" id="remember_syntax" #if $remember_syntax#checked #end if#> + <label for="remember_syntax">Remember syntax</label> + </li> + <li> + <input type="text" name="nick" id="nick" value="$nick"> + <input type="checkbox" name="remember_me" id="remember_me" #if $remember_me#checked #end if#> + <label for="remember_me">Remember me</label> </li> - <li><input type="text" name="nick" id="nick" value="$nick"> <label for="remember_me"><input type="checkbox" name="remember_me" id="remember_me" #if $remembered#checked="true" #end if#/> Remember me</label></li> <li><input type="text" name="title" id="title" value="Untitled"></li> <li><textarea rows="15" cols="80" name="text" id="text"></textarea></li> <li> |