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
############################################################################## | |
# | |
# Copyright (c) 2006 Zope Foundation and Contributors. | |
# All Rights Reserved. | |
# | |
# This software is subject to the provisions of the Zope Public License, | |
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | |
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | |
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
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
<configure xmlns="http://namespaces.zope.org/zope" | |
xmlns:monkey="http://namespaces.plone.org/monkey"> | |
<include package="collective.monkeypatcher" file="meta.zcml" /> | |
<monkey:patch | |
description="Patch setLoginTimes to disable that feature." | |
class="Products.PlonePAS.tools.membership.MembershipTool" | |
original="setLoginTimes" | |
replacement=".patches.setLoginTimes" |
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
1) use bootstrap.py from http://downloads.buildout.org/2/bootstrap.py | |
2) edit buildout.cfg and pin versions to: | |
[versions] | |
setuptools = 7.0 | |
zc.buildout = 2.2.5 | |
3) create a virtualenv as usal: |
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
<configure | |
xmlns="http://namespaces.zope.org/zope" | |
xmlns:browser="http://namespaces.zope.org/browser" | |
xmlns:security="http://namespaces.zope.org/security" | |
xmlns:zmi="http://namespaces.zope.org/zmi"> | |
<!-- Standard configuration directives --> | |
<include | |
file="configuration-meta.zcml" | |
package=".Configuration" | |
/> |
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
""" | |
Sublime 3 xml_pp (xmltwig) based xml auto formatter. | |
Setup in Sublime: | |
- sudo apt-get install xml-twig-tools | |
- in Sublime go to menu: Tools -> New Plugin... | |
- paste this file into the editor. | |
- save: use the preset location (~/.config/sublime-text-3/Packages/User) | |
and name it exactly "xmlppformat.py". | |
- in Sublime go to menu: Preferences -> Key Bindings - User | |
- add an keybinding i.e.: |
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
# -*- coding: utf-8 -*- | |
import csv | |
import pprint | |
import memcache | |
import pylibmc | |
import random | |
import string | |
import time | |
CYCLES = 10000 |
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() |
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 |
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' |
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) |
OlderNewer