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
# 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() |
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
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 |
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
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' |
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
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) |
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] | |
parts = py | |
[py] | |
recipe = zc.recipe.egg | |
eggs = lxml | |
interpreter = 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
[buildout] | |
find-links += | |
http://effbot.org/downloads/ | |
parts = | |
instance | |
omelette | |
extends = | |
http://dist.plone.org/release/4.1-latest/versions.cfg |
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] | |
parts = py | |
[py] | |
recipe = zc.recipe.egg | |
eggs = | |
setuptools | |
interpreter = 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
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): |
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 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 |
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
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