Here’s an idea that’s been kicking around inside my head recently.
A standard M2M relationship, as represented in SQL, looks like this:
CREATE TABLE movie (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
Index: openssl-1.0.1c/Makefile | |
=================================================================== | |
--- openssl-1.0.1c.orig/Makefile | |
+++ openssl-1.0.1c/Makefile | |
@@ -644,7 +644,7 @@ install_docs: | |
@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \ | |
here="`pwd`"; \ | |
filecase=; \ | |
- if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \ | |
+ if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" -o "$(PLATFORM)" = "darwin64-x86_64-cc" ]; then \ |
""" | |
>>> response = curl('http://news.ycombinator.com/') | |
>>> response.status | |
200 | |
>>> response.getheader('content-type') | |
'text/html; charset=utf-8' | |
>>> response.read(6) | |
'<html>' | |
>>> response.close() | |
""" |
from functools import partial | |
import cStringIO | |
import os | |
import threading | |
from tornado import ioloop | |
import teena | |
import os | |
import threading | |
class ObjectProxy(object): | |
"""Wrap a target object and provide an interface to its underlying object. | |
This is especially useful when you're defining an interface which overrides | |
the attribute access magic methods, but you still need to access named |
from nose.tools import assert_equal | |
addition_cases = [ | |
( | |
'2 + 2', | |
2, | |
2, | |
4 | |
), | |
( |
Here’s an idea that’s been kicking around inside my head recently.
A standard M2M relationship, as represented in SQL, looks like this:
CREATE TABLE movie (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
""" | |
Refactor out similarities between JSON objects. | |
""" | |
import abc | |
from mm import multimethod # TODO: implement. | |
def latest_common_ancestor(type1, type2): | |
"""Get the latest common ancestor of two types. |
""" | |
>>> @yields_from | |
... def example(): | |
... yield 1 | |
... yield 2 | |
... yield from_(iter(xrange(3, 6))) | |
... yield 6 | |
>>> for i in example(): | |
... print i |
Project Update #27: The Storm For backers only, Posted by cw&t Hi backers!
First, for those of you still waiting for your pen(s), we're still on schedule. The schedule was posted a few updates ago (update #22). The 3 remaining batches are shipped from our manufacturer in China on July 7th (480 pens) July 23rd (480) August 7th (494)
In the last couple months, we fought hard to speed up production. We advanced more money and were promised ship dates by our manufacturer and none were met. In their eyes, delays were caused by us because we were so picky about the details, but the truth is we weren't asking for anything out of the ordinary. All we asked for was for them to follow the specifications in our drawings they agreed to on day one. They weren't able to meet the specifications, so they blamed production delays on little changes made during production to help make the pen more manufacturable.
This could be the basis of a localized field implementation using hstore.
It mostly uses django-hstore, but then some simple JS in the admin replaces the default textarea with a richer key/value-oriented widget. The textarea is hidden, and changes in the keys and values of the form are just JSON-serialized back into the textarea—so it works with django-hstore as it is currently implemented, allows for easier programmatic access + manipulation, and doesn't require a lot of hacking.
The main change, code-wise, is that the hstore textareas need to be given an HTML class of 'hstore'. This requires more work than I think should be necessary—you need to wire the model field up to a form field, and the form field up to a widget, which replaces the class.