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
# deco-grid maker | |
# calculates widths and positions for the deco grid system for arbitrary | |
# number of columns, cell width and gutter (margin). | |
# author: Thomas Buchberger <[email protected]> | |
# last modified: Di 2 Nov 2010 18:05:36 CET | |
from optparse import OptionParser | |
def main(): |
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 ThreadedRequest(threading.Thread): | |
def __init__(self, url, data): | |
super(ThreadedRequest, self).__init__() | |
self.url = url | |
self.data = data | |
@log_error | |
def run(self): | |
response = urllib.urlopen(self.url, self.data) |
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 ldap.controls import SimplePagedResultsControl | |
import ldap | |
import csv | |
try: | |
# python-ldap 2.4 | |
LDAP_CONTROL_PAGED_RESULTS = ldap.CONTROL_PAGEDRESULTS | |
PYTHON_LDAP_24 = True | |
except AttributeError: | |
# python-ldap 2.3 |
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
"""ZODB export with support for cross-database references.""" | |
# Inital version by David Glick | |
# http://glicksoftware.com/blog/recombining-zodb-storages | |
# | |
# ZODB 3.10 and Blob support by Thomas Buchberger | |
from ZODB.blob import Blob | |
from ZODB.utils import p64, u64, cp | |
from ZODB.ExportImport import export_end_marker | |
from ZODB.ExportImport import blob_begin_marker |
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
# setup dummy request | |
from Testing.makerequest import makerequest | |
app=makerequest(app) | |
plone = app.unrestrictedTraverse('/Plone') | |
# get user context of portal owner | |
from AccessControl.SecurityManagement import newSecurityManager | |
user = plone.getOwner() | |
newSecurityManager(app, user) |
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.PythonScripts.standard import url_unquote | |
login = 'login' | |
portal = context.portal_url.getPortalObject() | |
# if cookie crumbler did a traverse instead of a redirect, | |
# this would be the way to get the value of came_from | |
#url = portal.getCurrentUrl() | |
#context.REQUEST.set('came_from', url) |
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
# Checks all UnIndex-based indexes for Unicode strings. | |
# Indexes should contain only byte strings. | |
# Having Unicode strings in indexes may result in UnicodeDecodeErrors during indexing or searching. | |
from Products.CMFPlone.interfaces import IPloneSiteRoot | |
from Products.CMFCore.utils import getToolByName | |
def get_plone_sites(root): | |
result = [] |
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
function FindProxyForURL(url, host) { | |
// Adressen, die auf example.com liegen, brauchen keinen Proxy: | |
if (shExpMatch(host,"*.example.com")) { | |
return "DIRECT"; | |
} | |
// URLs innerhalb dieses Netzwerkes werden abgefragt über | |
// Port 8080 auf fastproxy.example.com: (macht Nameserver Anfrage) | |
if (isInNet(host, "10.0.0.0", "255.255.248.0")) { | |
return "PROXY fastproxy.example.com:8080"; |
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 ZODB.serialize import referencesf | |
from ZODB.FileStorage import FileStorage | |
def build_refmap(filename): | |
"""Build a refmap from a filestorage. Look in every record of every | |
transaction. Build a dict of oid -> list(referenced oids) | |
""" | |
refmap = {} | |
fs = FileStorage(filename, read_only=1) |
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 json | |
import argparse | |
import os | |
parser = argparse.ArgumentParser() | |
parser.add_argument('dir', help='Directory containing zone files') | |
options = parser.parse_args() | |
path = os.path.abspath(options.dir) |