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 Node(object): | |
def __init__(self, db, name, parent, data): | |
self.db = db | |
self.data = data or {} | |
self.__name__ = self.data.get('__name__', None) | |
self.__parent__ = self.data.get('__parent__', None) | |
def __getitem__(self, name): | |
data = self.db.find_data_where_parent_is_my_objectid_and_name_is_name() | |
return Node(self.db, name, self, data) |
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
[pyodbc-environment] | |
CFLAGS=${odbc:location}/include | |
LDFLAGS=${odbc:location}/lib | |
[pyodbc] | |
# This has to come after installation of parts: odbc | |
recipe = zc.recipe.egg:custom | |
egg = pyodbc==2.1.x | |
include-dirs = ${odbc:location}/include | |
library-dirs = ${odbc:location}/lib |
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
(autoload 'js2-mode "js2" nil t) | |
(autoload 'espresso-mode "espresso" "Start espresso-mode" t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;; THe following 3 JS functions borrowed from Mihai Bazon | |
;;http://mihai.bazon.net/projects/editing-javascript-with-emacs-js2-mode | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;; use espresso mode for indentation |
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 User(declarative_base()): | |
__tablename__ = 'users' | |
id = Column(Integer, primary_key=True) | |
name = Column(String) | |
def __init__(self, name): | |
self.name = name | |
def to_dict(self): |
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
## widget | |
import httplib2 | |
from urllib import urlencode | |
import colander | |
from colander import null | |
from colander import Invalid | |
from deform.widget import CheckedInputWidget |
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
## models | |
from persistent import Persistent | |
from persistent.mapping import PersistentMapping | |
class NDMWD(PersistentMapping): | |
__parent__ = None | |
__name__ = None | |
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
diff --git a/deliverance/middleware.py b/deliverance/middleware.py | |
index 03c3b70..f44af34 100644 | |
--- a/deliverance/middleware.py | |
+++ b/deliverance/middleware.py | |
@@ -101,12 +101,18 @@ class DeliveranceMiddleware(object): | |
return self.clientside_response(req, rule_set, resource_fetcher, log)(environ, start_response) | |
else: | |
log.debug(self, 'Not doing clientside theming because jsEnabled cookie not set') | |
+ | |
+ headresp = None |
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 decimal import Decimal | |
from pymongo.son_manipulator import SONManipulator | |
class DecimalTransform(SONManipulator): | |
def transform_incoming(self, son, collection): | |
for (key, value) in son.items(): | |
if isinstance(value, Decimal): | |
son[key] = {'_type' : 'decimal', 'value' : unicode(value)} | |
elif isinstance(value, dict): | |
son[key] = self.transform_incoming(value, collection) |
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
# framework | |
# from http://paste.ofcode.org/bnQGsYx8FWNGTBbYPS6W4k | |
class PylonsControllerViewMapper(object): | |
def __init__(self, **kw): | |
self.kw = kw | |
def __call__(self, view): | |
attr = self.kw['attr'] |
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 http://paste.ofcode.org/39mWESwBQbwasheLuuYjRUv | |
# framework | |
from pyramid.view import static | |
# five year expires time | |
static_view = static('static', cache_max_age=157680000) | |
version_match = re.compile(r'^r\d{1,19}$').match | |
# version number is "r" plus an intified timetime, e.g. r1234567890 |
OlderNewer