This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Provides a `DateTimeRange` class, which is used for managing ranges of datetimes.""" | |
import datetime | |
class DateTimeRange(object): | |
"""Represents a range of datetimes, with a start and (optionally) an end. | |
Basically implements most of the methods on a standard sequence data type to provide | |
some lovely syntactic sugar. Specifically, you can iterate on this, index it, slice it, | |
use the in operator, reverse it, and use it in a boolean context to see if there is any | |
time in between the start and end.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Utilities for managing database sessions.""" | |
from __future__ import with_statement | |
import contextlib | |
import functools | |
@contextlib.contextmanager | |
def temp_session(session_cls, **kwargs): | |
"""Quick and dirty context manager that provides a temporary Session object | |
to the nested block. The session is always closed at the end of the block. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implements an anchor-based permalink system, with handlers assigned to a component. | |
* The format used is "/page/#key1:(value1,value2),key2:(value3,value4)[...]" | |
*/ | |
var PermalinkManager = new Class({ | |
Implements: Class.Binds, | |
Binds: ['processHash'], | |
initialize: function() { | |
this.handlers = new Hash(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implements an anchor-based permalink system, with handlers assigned to a component. | |
* The format used is "/page/#key1:(value1,value2),key2:(value3,value4)[...]" | |
*/ | |
var PermalinkManager = new Class({ | |
Implements: [Events, Class.Binds], | |
Binds: ['processHash'], | |
initialize: function() { | |
this.handlers = new Hash(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cStringIO import StringIO | |
from decimal import Decimal | |
from PIL import Image | |
from urllib2 import urlopen | |
from django.db import transaction | |
from django.core.files.base import ContentFile | |
from ilovephotos.blacktip import models | |
from ilovephotos.blacktip.util.parse_help import verify_args, get_list_ids |
NewerOlder