This file contains hidden or 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
for f in `find ./ -type l`; do | |
lpath=`readlink $f` | |
echo $lpath | egrep "^/home/dev/python-buildout/src/parts/opt/include/python2.4" > /dev/null | |
if [ "$?" = "0" ]; then | |
newpath=`echo $lpath | sed -e 's:/home/dev/python-buildout/src/parts/opt/include/python2.4:/Users/richard/Documents/Projects/collective.buildout.python/python-2.4/lib/python2.4:g'` | |
rm $f | |
ln -s $newpath $f | |
fi | |
done |
This file contains hidden or 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_ie(request, min_version=None, max_version=None): | |
user_agent = request.environ.get('HTTP_USER_AGENT', '') | |
ie = user_agent.find('MSIE') | |
if ie==-1: | |
return False | |
if not min_version and not max_version: | |
return True | |
version_match = re.match('[\d\.]*', user_agent[ie+5:]) |
This file contains hidden or 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
[buildout] | |
eggs = ... | |
parts = ... | |
pastescript | |
[pastescript] | |
recipe = zc.recipe.egg | |
eggs = PasteScript # required to generate the specific paster script if not already in eggs list | |
${buildout:eggs} | |
extra-paths = path/to/pastescriptpatches.py |
This file contains hidden or 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
# http://pypi.python.org/pypi/chardet | |
import chardet | |
# List of your preferred charsets, or detect those available automatically (see below) | |
CHARSETS = ['ascii', 'latin_1', 'utf_8'] | |
def get_charset(string): | |
"""Given a string or unicode object, returns the simplest available |
This file contains hidden or 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
import datetime | |
import re | |
import warnings | |
def strftime(dt, fmt): | |
if dt.year < 1900: | |
# create a copy of this datetime, just in case, then set the year to | |
# something acceptable, then replace that year in the resulting string | |
tmp_dt = datetime.datetime(datetime.MAXYEAR, dt.month, dt.day, | |
dt.hour, dt.minute, |
This file contains hidden or 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
[buildout] | |
extends = versions.cfg | |
parts = | |
plone | |
zope2 | |
productdistros | |
instance | |
live-client | |
omelette |
This file contains hidden or 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
catalog_interfaces = ('plone.app.discussion.interfaces.IComment',) | |
pc = context.portal_catalog | |
comment_brains = pc(object_provides=tuple(catalog_interfaces)) | |
for b in comment_brains: | |
comment = b.getObject() | |
comment_id = comment.comment_id | |
conversation = comment.aq_parent |
This file contains hidden or 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 unlockAllObjects(app, path): | |
lockedobjs = findLockedObjects(app, path) | |
for (o, p, i) in lockedobjs: | |
errs = False | |
for l in [li['token'] for li in i]: | |
try: | |
o.wl_delLock(l) | |
except: | |
errs = True | |
if errs: |
This file contains hidden or 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
<configure xmlns="http://namespaces.zope.org/zope"> | |
<subscriber | |
for=".interfaces.IMyType | |
OFS.interfaces.IObjectWillBeRemovedEvent" | |
handler=".events.event_handler" | |
/> | |
</configure> |