Skip to content

Instantly share code, notes, and snippets.

@gvangool
gvangool / CouchObject.py
Created June 15, 2009 06:12 — forked from leah/CouchObject.py
Convert between a CouchDB document and Python object.
class CouchObject(object):
'''
Convert between a CouchDB document and Python object.
Create Python objects while maintaining a schema-free database.
Define object properties without storing null fields.
'''
@property
def id(self):
return self._id
@gvangool
gvangool / gist:129962
Created June 15, 2009 06:11 — forked from simonw/gist:127850
Validate that an uploaded file is a PDF
# Django: validate that an uploaded file is a valid PDF
import pyPdf # from http://pybrary.net/pyPdf/
from pyPdf.utils import PdfReadError
class DocumentForm(forms.ModelForm):
pdf = forms.FileField()
class Meta:
model = Document
@gvangool
gvangool / ericflopsy.py
Created June 11, 2009 13:08 — forked from ericflo/ericflopsy.py
A simple way to interact with AMQPlib
"""
Copyright (c) 2008-2009, Nathan Borror, and modified heavily by Eric Florenzano
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this