View versionfinder.py
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
# versionfinder | |
import re | |
regexp = re.compile('.*\/(.*)-(.*)-py') | |
with open('instance', 'r') as ins: | |
for line in ins.readlines(): | |
res = regexp.match(line) | |
if res is None: | |
continue | |
print "%s = %s" % res.groups() |
View actions.py
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 zope.interface import Interface | |
from zope.interface import directlyProvides | |
from zope.interface import noLongerProvides | |
from Products.Five.browser import BrowserView | |
from Products.CMFPlone.interfaces import INavigationRoot | |
from Products.CMFPlone import PloneMessageFactory as _ | |
class IPossibleNavigationRoot(Interface): | |
pass |
View gist:953532
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 Products.Five.browser import BrowserView | |
class LangRedir(BrowserView): | |
"""language redirect""" | |
def __call__(self): | |
target = 'en-ie' | |
for lang in self.context.portal_languages.getRequestLanguages(): | |
if lang in ('de-at', 'de-ch'): | |
target = 'de-at' |
View dcwf2dot.py
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
context.REQUEST.response.setHeader('Content-Type', 'text/plain') | |
print "digraph %s {" % context.getId() | |
wf = context | |
state_to_trans = [] | |
for state in wf.states.values(): | |
roles = state.getAvailableRoles() | |
roles.sort() | |
permtable = [ ['<FONT POINT-SIZE="10">%s</FONT>' % _ for _ in ['permission', 'acquired'] + roles ] ] | |
for perm in state.getManagedPermissions(): | |
pinfo = state.getPermissionInfo(perm) |
View buildout.cfg
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
[buildout] | |
parts = py | |
[py] | |
recipe = zc.recipe.egg | |
eggs = lxml | |
interpreter = py |
View buildout.cfg
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
[buildout] | |
find-links += | |
http://effbot.org/downloads/ | |
parts = | |
instance | |
omelette | |
extends = | |
http://dist.plone.org/release/4.1-latest/versions.cfg |
View buildout.cfg
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
[buildout] | |
parts = py | |
[py] | |
recipe = zc.recipe.egg | |
eggs = | |
setuptools | |
interpreter = py |
View action.py
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 zope.interface import Interface | |
from zope.interface import directlyProvides | |
from zope.interface import noLongerProvides | |
from Products.Five.browser import BrowserView | |
from Products.CMFPlone import PloneMessageFactory as _ | |
class ISomeFeatureTarget(Interface): | |
pass | |
class IPossibleSomeFeatureTarget(Interface): |
View locandy_gae.tests.py
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
import unittest | |
import doctest | |
from pprint import pprint | |
from interlude import interact | |
from google.appengine.ext import testbed | |
optionflags = doctest.NORMALIZE_WHITESPACE | \ | |
doctest.ELLIPSIS | \ | |
doctest.REPORT_ONLY_FIRST_FAILURE |
View querystring.py
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 plone.app.querystring.queryparser import getPathByUID, getNavigationRoot | |
def _multi_path(context, row): | |
values = [] | |
for value in row.values.split(): | |
if not '/' in value: | |
# It must be a UID | |
value = '/'.join(getPathByUID(context, value)) | |
# take care of absolute paths without nav_root | |
nav_root = getNavigationRoot(context) |
OlderNewer