Created
December 4, 2011 22:06
-
-
Save yamaneko1212/1431439 to your computer and use it in GitHub Desktop.
なんかよくわからんが, すごい短い間隔でDBをドロップすると, GridFSの部分で失敗する. あとで細かいことを検証しよう.
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
# -*- coding: utf-8 | |
# This code doesn't work correctly. | |
# Reproduced on Python 2.7, Mongodb 1.8.4, pymongo 2.0.1 and mongoengine 0.5 | |
from mongoengine import Document, FileField, connect | |
import pymongo | |
db = 'my_test' | |
class C(Document): | |
f = FileField() | |
def drop_db(): | |
con = pymongo.Connection() | |
con.drop_database(db) | |
return | |
def test_code(): | |
c = C() | |
c.f = 'data' | |
c.save() | |
return | |
if __name__ == "__main__": | |
connect(db) | |
drop_db() | |
test_code() | |
drop_db() | |
test_code() | |
drop_db() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment