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
set viminfo='20,\"500 | |
set ai sw=2 expandtab | |
set title | |
set hidden | |
set nocompatible | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
syntax on | |
" From Bram: | |
" When editing a file, always jump to the last known cursor position. |
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
Got zope.interface 3.6.3. | |
Getting distribution for 'distribute==0.6.19'. | |
Before install bootstrap. | |
Scanning installed packages | |
Setuptools installation detected at /usr/lib/python2.6/dist-packages | |
Non-egg installation | |
Removing elements out of the way... | |
Already patched. | |
/usr/lib/python2.6/dist-packages/setuptools.egg-info already patched. | |
After install bootstrap. |
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
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz | |
Extracting in /tmp/tmp9_wgB5 | |
Now working in /tmp/tmp9_wgB5/distribute-0.6.21 | |
Building a Distribute egg in /tmp/tmpUy_zwk | |
/tmp/tmpUy_zwk/distribute-0.6.21-py2.6.egg | |
Creating directory '/home/pmr2/bbslave_pmr2/buildoutruntests/build/bin'. | |
Creating directory '/home/pmr2/bbslave_pmr2/buildoutruntests/build/parts'. | |
Creating directory '/home/pmr2/bbslave_pmr2/buildoutruntests/build/eggs'. | |
Creating directory '/home/pmr2/bbslave_pmr2/buildoutruntests/build/develop-eggs'. | |
Getting distribution for 'distribute==0.6.19'. |
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
set viminfo='20,\"500 | |
set ai sw=2 expandtab | |
set title | |
set hidden | |
set nocompatible | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
syntax on | |
" From Bram: | |
" When editing a file, always jump to the last known cursor position. |
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
def format_reinforcement(delta_t): | |
hours = delta_t.seconds / 3600 | |
days = delta_t.days | |
seconds = delta_t.seconds | |
# Don't ask. Read the test; be happy you don't have to write this. | |
# (WTB something simple like str(delta_t) with more control.) | |
# (Maybe I should just do this in javascript?) | |
return '%(day)s%(hour)s' % { | |
'day': days and '%(days)d day%(dayp)s%(comma)s' % { |
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 time import time | |
>>> from pygit2 import Signature | |
>>> from pygit2 import Repository | |
>>> from pygit2 import init_repository | |
>>> from pygit2 import GIT_FILEMODE_BLOB, GIT_FILEMODE_TREE | |
>>> | |
>>> repo = init_repository('/tmp/repodir', bare=True) | |
>>> tf1 = repo.create_blob('this is a test file') | |
>>> tf2 = repo.create_blob('some other blob') | |
>>> tf3 = repo.create_blob('this is a test file2') |
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
""" | |
Instructions: (save this file as app.py or whatever) | |
$ virtualenv .env | |
$ . .env/bin/activate | |
(.env) $ pip install flask | |
(.env) $ python app.py | |
""" | |
import json |
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 os | |
import stat | |
from ZPublisher.Iterators import filestream_iterator | |
from zope.publisher.browser import BrowserPage | |
class FilestreamPage(BrowserPage): | |
target = '/path/to/some/file' |
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 flask import Flask, request, abort, g, current_app | |
from flask.ext.principal import Principal | |
from flask.ext.principal import Identity, identity_changed, identity_loaded | |
from flask.ext.principal import Permission, Need, RoleNeed, ItemNeed | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = 'test_secret_key' | |
app.config['TESTING'] = True |
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 transaction | |
from Acquisition import aq_base, aq_inner, aq_parent | |
from Products.CMFCore.utils import getToolByName | |
from pprint import pprint as pp | |
catalog = getToolByName(app.cmiss, 'portal_catalog') | |
releases = catalog.searchResults(portal_type='PSCRelease') | |
o = [i.getObject() for i in releases] | |
pp([(i,i.workflow_history['psc_release_workflow'][-1]['review_state']) for i in o]) | |
wftool = getToolByName(app.cmiss, 'portal_workflow') | |
wfdef = getattr(aq_base(wftool), 'psc_release_workflow', None) |
OlderNewer