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
""" | |
On 01/30/2011 09:04 AM, Wade Leftwich wrote: | |
If you want to stick with Traversal, don't forget that you have | |
request.subpath available to you. For the path "/blog/archive/ | |
2011/01/29/my-post-about-pyramid", you could have an Archive context | |
whose default (unnamed) view would be called with a request that | |
included request.subpath = ['2011', '01', '29', 'my-post-about- | |
pyramid']. | |
Other traversal-based strategies: |
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
""" | |
https://bitbucket.org/ianb/webob/changeset/6b1f2d09fee7#chg-webob/request.py_newline489 | |
self.body_file_raw appears to re-escape characters on each POST | |
property access | |
whereas self.body_file does not. I think the latter is the correct | |
behavior. | |
I tried to make some failing test for you, but I was struggling |
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
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(flymake-errline ((((class color)) (:underline "OrangeRed")))) | |
'(flymake-warnline ((((class color)) (:underline "yellow")))) | |
) |
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://pastie.org/1695550 | |
def JsonPRendererFactory(info): | |
"""A special renderer which returns JSONP data. | |
Be careful to only return data that can be dumped to JSON. In particular | |
unicode strings may not work. | |
""" | |
def render(value, system): | |
request=system.get("request") |
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 Category(ContextBySpec): | |
__name__= None | |
__collection__ = __parent__ = 'categories' | |
def __init__(self, request, path_segments=None, **kwd): | |
super(ContextBySpec, self).__init__(self, request, **kwd) | |
for k,v in kwd.items(): | |
setattr(self, k, v) | |
if not path_segments: | |
path_segments = request.path_info.split('/') | |
self.__name__ = path_segments.pop(0) |
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 colander import Email | |
from colander import Schema | |
from colander import SchemaNode | |
from colander import Sequence | |
from colander import SequenceSchema | |
from colander import String | |
from colander import Tuple | |
from colander import null | |
from limone_zodb import content_schema |
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
## fix "Waiting for other installations to complete." on OSX 10.6 10.7 | |
## sometimes a failed installation leaves us unable to | |
## perform an installation. The following fixes it for me | |
sudo rm /private/var/db/mds/system/mds.install.lock | |
sudo reboot |
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
<textarea id="${field.oid}" class="richtext" | |
name="${field.name}">${cstruct}</textarea> | |
<script language="javascript" | |
type="text/javascript"> | |
deform.addCallback( | |
'${field.oid}', | |
function(oid) { | |
tinyMCE.init({ | |
mode : 'exact', | |
elements: oid, |
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 is_really_image(node, value): | |
request = get_current_request() | |
tmpstore = MongoTmpStore(request) | |
image_uid = value['uid'] | |
fp = tmpstore[image_uid]['fp'] | |
fp.seek(0) | |
try: | |
Image.open(fp) | |
except IOError: | |
raise colander.Invalid( |
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 is_really_image(node, value): | |
request = get_current_request() | |
tmpstore = MongoTmpStore(request) | |
image_uid = value['uid'] | |
fp = tmpstore[image_uid]['fp'] | |
fp.seek(0) | |
try: | |
Image.open(fp) | |
except IOError: | |
raise colander.Invalid( |