Skip to content

Instantly share code, notes, and snippets.

diff --git a/opencore/nui/wiki/bzrbackend.py b/opencore/nui/wiki/bzrbackend.py
index 7d2cad3..6234395 100644
--- a/opencore/nui/wiki/bzrbackend.py
+++ b/opencore/nui/wiki/bzrbackend.py
@@ -5,6 +5,8 @@ import logging
from opencore.interfaces.catalog import ILastModifiedAuthorId
from opencore.utils import get_config
import os
+import pickle
+import cPickle
${chrome.logging.debug("This is a log message in a genshi template")}
@ejucovy
ejucovy / gist:5079195
Last active December 14, 2015 11:29
Initializing a new trac database for an existing environment.
from trac.env import Environment
from trac.db import DatabaseManager
from trac import db_default
env = Environment("/path/to/my/env")
DatabaseManager(env).init_db()
with env.db_transaction as db:
for table, cols, vals in db_default.get_data(db):
db.executemany("INSERT INTO %s (%s) VALUES (%s)" % (table, ','.join(cols), ','.join(['%s' for c in cols])), vals)
With 100K tickets and eight custom fields, in the current system:
{{{
2013-02-04 11:27:23,508 Trac[web_ui] INFO: needed 2.1167910099 seconds for searching terms '[u'nardine']'
2013-02-04 11:27:28,881 Trac[web_ui] INFO: needed 2.04926395416 seconds for searching terms '[u'nardine', u'reminiscency']'
2013-02-04 11:27:34,073 Trac[web_ui] INFO: needed 2.05887007713 seconds for searching terms '[u'nardine', u'reminiscency', u'Niagaran']'
2013-02-04 11:27:37,980 Trac[web_ui] INFO: needed 2.05345582962 seconds for searching terms '[u'nardine', u'reminiscency', u'Niagaran', u'pyramidize']'
2013-02-04 11:27:41,786 Trac[web_ui] INFO: needed 2.06689596176 seconds for searching terms '[u'nardine', u'reminiscency', u'Niagaran', u'pyramidize', u'monasterially']'
}}}
jQuery(document).ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
[[PageOutline]]
= Installing and Integrating Trac and Gitolite =
This blog post details how I install Trac and Gitolite using:
* Trac 1.0
* Gitolite v3
* Ubuntu 12.04 LTS
* Python 2.7.3
@ejucovy
ejucovy / gist:3394993
Created August 19, 2012 13:57
Trac FineGrainedPermissions for repository - sample code
from trac.core import *
from trac.perm import IPermissionPolicy
class MultiRepoPermissionSystem(Component):
implements(IPermissionPolicy)
# Helper methods
def parent_repository(self, resource):
while True:
@ejucovy
ejucovy / gist:2965585
Created June 21, 2012 12:50
I want a tool that can do this.
egj@alcibiades:~$ echo "PasteScript==1.7.5
> WebOb==1.0
> python-dateutil
> http://launchpad.net/bzr/2.3/2.3.4/+download/bzr-2.3.4.tar.gz
> -e svn+https://svn.socialplanning.org/svn/fassembler/tags/0.4#egg=fassembler-0.4
> -e [email protected]:deliverance/Deliverance#egg=Deliverance-dev" > /tmp/req1.txt
egj@alcibiades:~$ echo "WebOb==1.2
> python-dateutil==2.1
> Paste==1.7.5.1
date = dateutil.parser.parse("1/1/2012")
users = User.objects.filter(actions__created_at__gte=date)
users = users.annotate(num_actions=Count('actions'))
users = users.filter(num_actions__gte=5)
@ejucovy
ejucovy / gist:1958529
Created March 2, 2012 13:55
django geoip in a request
from django.contrib.gis.utils import GeoIP
def my_view(request):
ip_addr = request.META.get("REMOTE_ADDR")
assert ip_addr is not None
g = GeoIP()
lat, lng = g.lat_lon(ip_addr)