Skip to content

Instantly share code, notes, and snippets.

class QuerySetDoubleIteration(Exception):
"A QuerySet was iterated over twice, you probably want to list() it."
pass
# "Skinny" here means we use iterator by default, rather than
# ballooning in memory.
class SkinnyManager(Manager):
def get_query_set(self):
return SkinnyQuerySet(self.model, using=self._db)
dojo.provide 'cdoc.mixins.search'
dojo.require "dijit.form.ValidationTextBox"
dojo.require "dijit.layout.BorderContainer"
dojo.require "dijit.layout.ContentPane"
dojo.require "dojo.data.ItemFileReadStore"
dojo.require "cdoc.string.quicksilver"
dojo.declare "cdoc.mixins.search", [dijit.layout.BorderContainer], {
title: "Mixins"
cdoc.string.quicksilver: (string, abbreviation, offset) ->
offset: or 0
len: abbreviation.length
return 0.9 if len is 0
return 0.0 if len > string.length
for i in [len...0]
sub_abbreviation: abbreviation.substring 0, i