Skip to content

Instantly share code, notes, and snippets.

View melinath's full-sized avatar

Stephen Lewis (Burrows) melinath

View GitHub Profile
# Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# Miro Community is distributed in the hope that it will be useful,
@melinath
melinath / with_localvars.tb
Created December 17, 2011 00:59
Stem___call__ traceback
Environment:
Request Method: GET
Request URL: .../video/8000/2108-making-a-big-company-feel-smal
Django Version: 1.3
Python Version: 2.6.5
Installed Applications:
['django.contrib.staticfiles',
index d2d20e8..30dadec 100644
--- a/localtv/models.py
+++ b/localtv/models.py
@@ -822,6 +822,36 @@ class Feed(Source, StatusedThumbnailable):
def get_absolute_url(self):
return ('localtv_list_feed', [self.pk])
+ @classmethod
+ def from_scraped_feed(cls, feed, user, status=None, auto_approve=False):
+ current_site = Site.objects.get_current()
@melinath
melinath / requirements.txt
Created September 29, 2011 23:37
Dev setup for mirocommunity
-e git+http://git.participatoryculture.org/djpagetabs@master#egg=djpagetabs-0.0.1-py2.6-dev
-e git+http://git.participatoryculture.org/djvideo@master#egg=djvideo-0.0.1-py2.6-dev
-e git+git://github.com/pculture/vidscraper.git@pre-suite#egg=vidscraper-0.0.1-py2.6-dev
-e git+http://git.participatoryculture.org/django-email-share/@master#egg=django_email_share-0.0.1-py2.6-dev
-e git+http://git.participatoryculture.org/django-uploadtemplate@master#egg=django_uploadtemplate-0.0.1-py2.6-dev
BeautifulSoup==3.2.0
Django==1.3.1
PIL==1.1.7
lxml==2.3beta1
-e hg+http://bitbucket.org/andrewgodwin/south/@tip#egg=south
@melinath
melinath / search_indexes.py
Created September 24, 2011 01:35
Haystack 2
from django.db import Count
from haystack import indexes
from learnit.models import Course
class CourseIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
author = indexes.IntegerField(model_attr="user_id")
# From basket app
from core.utils import registry
from basket.abstract_models import AbstractBasket
if "Basket" not in registry or registry.get("Basket")._meta.app_label == "basket":
class Basket(AbstractBasket):
pass
{% extends 'oncampus/students/base.html' %}
{% load collections pipette_tags %}
{% block content %}
{% spaceless %}
{% container banners references philo.collection as banners_collection %}
{% membersof banners_collection with oberlin.banner as banners %}
{% container newsletter_node references philo.node as newsletter_node %}
from django.contrib.localflavor.us import us_states
from django.contrib.localflavor.us.models import USStateField
from django.db import models
from .utils import US_STATE_CHAR2FIPS, US_STATE_FIPS, US_STATE_FIPS_SHORT
class USStateFipsCode(object):
"""A US state class which includes FIPS characters and numbers."""
def __init__(self, number):
@melinath
melinath / autocompile.py
Created June 1, 2011 20:37
Class-based reloading
#!/usr/bin/env python
import subprocess
import sys
from reloader.reloaders import FileChangeReloader
def auto_compile(path, filetypes, cmd):
filetypes = filetypes.split(',')
function multifloor_time_area(cfg)
local id = cfg.id
local floor = cfg.floor
cfg.id = nil
cfg.floor = nil
local locations = wesnoth.get_locations(cfg)
-- then do things!
end