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 datetime import datetime | |
from mongoengine import * | |
from mongoengine.queryset import queryset_manager | |
from re import sub | |
class FamigoDocument(Document): | |
_active = BooleanField(default=True, required=True) | |
@queryset_manager | |
def active(cls, queryset): |
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 copy import deepcopy | |
from mongoengine import Document, ReferenceField, connect | |
class Foo(Document): | |
pass | |
class Bar(Document): | |
foo = ReferenceField(Foo) | |
connect('tmp-deepcopy') |
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
#!/usr/bin/env python | |
from BeautifulSoup import BeautifulStoneSoup | |
from urllib2 import urlopen | |
from urllib import urlretrieve | |
from os.path import basename | |
import sys | |
def main(argv=None): | |
if argv is None: |
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
[<A: A object>, <A: A object>, <B: B object>] | |
Traceback (most recent call last): | |
File "unique3.py", line 20, in <module> | |
print B.objects | |
File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/queryset.py", line 1131, in __repr__ | |
File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/queryset.py", line 776, in __getitem__ | |
File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/queryset.py", line 427, in _cursor | |
File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/queryset.py", line 402, in _collection | |
File "build/bdist.linux-i686/egg/pymongo/collection.py", line 717, in ensure_index | |
File "build/bdist.linux-i686/egg/pymongo/collection.py", line 639, in create_index |
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
Traceback (most recent call last): | |
File "unique.py", line 15, in <module> | |
B(foo=True).save() | |
File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/document.py", line 85, in save | |
mongoengine.queryset.OperationError: Tried to save duplicate unique keys (E11000 duplicate key errorindex: tmp-unique.a.$foo_1 dup key: { : null }) |
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 copy import deepcopy | |
from mongoengine import * | |
from pymongo import Connection | |
class A(Document): | |
binary_field = BinaryField() | |
boolean_field = BooleanField() | |
date_time_field = DateTimeField() | |
decimal_field = DecimalField() | |
dict_field = DictField() |
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
<!doctype html> | |
<html> | |
<head> | |
<title>RTCDataChannel</title> | |
</head> | |
<body> | |
<p> | |
<a href="https://github.com/samdutton/simpl/tree/master/rtcdatachannel"> |
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
#!/usr/bin/env python | |
import BeautifulSoup | |
import cookielib | |
import re | |
import urllib2 | |
def parse_rating(rating): | |
"""Parse a rating's class name and return it as a number. |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
html, body { | |
background: silver; | |
margin: 0; |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta content="maximum-scale=1,minimum-scale=1,width=device-width" name="viewport"> | |
<style> | |
body { | |
margin: 0; |