Skip to content

Instantly share code, notes, and snippets.

View jezdez's full-sized avatar
🚴
💨

Jannis Leidel jezdez

🚴
💨
View GitHub Profile
from flask import Module, request, redirect, url_for, render_template, abort
from formalchemy import FieldSet
from example import db
from example import Service, User, Forum, Category, Topic, Post
mod = Module(__name__)
models = {
@eykd
eykd / pycache.py
Created October 26, 2010 15:06
A simple script for caching packages on S3 and building simple HTML indices.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pycache -- cache a python package from PyPI on S3.
A simple script to collect a cache of packages locally and sync them up to an S3 bucket, using directories as namespaces so that different projects can have different dependencies.
This is just about the simplest thing that could possibly work.
"""
import warnings
warnings.filterwarnings('ignore')
@jacobian
jacobian / deleting_file_field.py
Created March 27, 2011 22:19
DeletingFileField
from django.db import models
from django.db.models import signals
class DeletingFileField(models.FileField):
"""
FileField subclass that deletes the refernced file when the model object
itself is deleted.
WARNING: Be careful using this class - it can cause data loss! This class
makes at attempt to see if the file's referenced elsewhere, but it can get
@gregmuellegger
gregmuellegger / proposal.rst
Created April 1, 2011 15:46
GSoC 2011 Proposal - Revised form rendering

GSoC 2011 Proposal - Revised form rendering

Hi my name is Gregor Müllegger. I'm a Computer Science student in Germany at the University of Augsburg currently in the fourth year of my studies. I first came to django shortly before 0.96 was released and a lots of awesomeness was introduced with the magic removal branch.

I'm also doing some django freelancing work since 2008 to finance my studies and attended DjangoCon EU in 2010. This year I would like to apply to

LOGGING = {
...
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
...
},
'loggers': {
@epicserve
epicserve / sublime_text_2_notes.md
Created July 27, 2011 15:40
Notes on My Sublime Text 2 Setup

User File Settings

{
    "draw_indent_guides": false,
    "fold_buttons": true,
    "font_face": "Meslo LG S",
    "font_size": 13,
    "highlight_line": true,
    "ignored_packages": [],

"open_files_in_new_window": false,

@embray
embray / setup.cfg
Created September 2, 2011 19:29
A d2to1 example of setup_hooks and pre/post command hooks
$ ./setup.py build
Setting up testproj
running build
running pre_hook testproj.pre_build_hook for command build
Someone is building my project!
running build_py
running post_hook testproj.post_build_hook for command build
Someone built my project!
@martijnvermaat
martijnvermaat / gpl-and-closed-software.markdown
Created September 7, 2011 21:15
The GPL in combination with closed source software

The GPL in combination with closed source software

Here are a few issues concerning GPL-licensed software in combination with closed source software. We assume [version 2 of the GPL] [1] in the following discussion.

What exactly is a work "derived from" the Program?

@leah
leah / json-response.py
Created October 5, 2011 19:08
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None
@ojii
ojii / messages_test_mixin.py
Created October 7, 2011 10:01
django messages framework testing utilities
from contextlib import contextmanager
from django.contrib.messages.storage.base import BaseStorage, Message
from django.test.client import RequestFactory
from django.utils.decorators import method_decorator
class TestMessagesBackend(BaseStorage):
def __init__(self, request, *args, **kwargs):
self._loaded_data = []
super(TestMessagesBackend, self).__init__(request, *args, **kwargs)