This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DebugLevelFilter(Filter): | |
max_debug_level = None | |
def __init__(self, required_level): | |
super(DebugLevelFilter, self).__init__() | |
self.required_level = required_level | |
def input(self, in_, out, source_path, **kw): | |
if self.required_level == self.env.debug: | |
out.write(in_.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DebugLevelFilter(Filter): | |
max_debug_level = None | |
def __init__(self, required_level): | |
super(DebugLevelFilter, self).__init__() | |
self.required_level = required_level | |
def input(self, in_, out, **kw): | |
if self.required_level == self.env.debug: | |
out.write(in_.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Templating | |
(function($, global) { | |
'use strict'; | |
var templates = null; | |
function loadTemplates() { | |
if(!$.isReady) { | |
console.error('Tried loading templates before DOMReady'); | |
console.trace(); | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from indico.util.fossilize import IFossil | |
from MaKaC.common.Announcement import getAnnoucementMgrInstance | |
@HTTPAPIHook.register | |
class RangeHook(HTTPAPIHook): | |
TYPES = ('num', 'char') | |
RE = r'(?P<start>[0-9]+|[a-z])-(?P<end>[0-9]+|[a-z])' | |
DEFAULT_DETAIL = 'simple' | |
MAX_RECORDS = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XAccelMiddleware(object): | |
"""A WSGI Middleware that converts X-Sendfile headers to X-Accel-Redirect | |
headers if possible. | |
If the path is not mapped to a URI usable for X-Sendfile we abort with an | |
error since it likely means there is a misconfiguration. | |
""" | |
def __init__(self, app, mapping): | |
self.app = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/foo/<path:bla>/') | |
def foo_path(bla): | |
print 'foo_path', bla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# vim: et ts=4 sw=4 ft=sh | |
# Interesting post on max line length: | |
# http://stackoverflow.com/questions/88942/why-should-python-pep-8-specify-a-maximum-line-length-of-79-characters | |
PEP8_OPTIONS='--max-line-length=120' | |
RED=`echo -e "\033[1;31m"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /home/adrian/dev/indico/env/lib/python2.7/site-packages/pep8.py 2013-06-09 15:46:35.000000000 +0200 | |
+++ ./lib/python2.7/site-packages/pep8.py 2013-06-25 14:57:01.522980981 +0200 | |
@@ -1100,21 +1100,24 @@ | |
# For each file of the diff, the entry key is the filename, | |
# and the value is a set of row numbers to consider. | |
rv = {} | |
- path = nrows = None | |
+ path = nrows = row = None | |
for line in diff.splitlines(): | |
if nrows: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def undo_changes(after): | |
root = dbi.getInstance().getDBConnection().root() | |
db = root._p_jar.db() | |
undo_data = [obj for obj in db.undoInfo(last=-1000) if obj['time'] >= after] | |
for entry in undo_data: | |
db.undo(entry['id']) | |
dbi.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: UTF-8 | |
import re | |
from flask import Flask, jsonify, render_template, request, redirect | |
from flask.ext.mail import Mail, Message | |
app = Flask(__name__) | |
mail=Mail(app) | |
app.config.update( |