<s> '''<STR_LIT>''' <EOL> from cola . core . errors import DependencyNotInstalledError <EOL> from conf import mongo_host , mongo_port , db_name , shard_key <EOL> try : <EOL> from mongoengine import connect , Document , EmbeddedDocument , DoesNotExist , Q , StringField , DateTimeField , EmailField , BooleanField , URLField , IntField , FloatField , ListField , EmbeddedDocumentField , ValidationError <EOL> except ImportError : <EOL> raise DependencyNotInstalledError ( '<STR_LIT>' ) <EOL> connect ( db_name , host = mongo_host , port = mongo_port ) <EOL> DoesNotExist = DoesNotExist <EOL> Q = Q <EOL> ValidationError = ValidationError <EOL> class Forward ( EmbeddedDocument ) : <EOL> mid = StringField ( required = True ) <EOL> uid = StringField ( required = True ) <EOL> avatar = URLField ( ) <EOL> content = StringField ( ) <EOL> created = DateTimeField ( ) <EOL> class Comment ( EmbeddedDocument ) : <EOL> uid = StringField ( required = True ) <EOL> avatar = URLField ( ) <EOL> content = StringField ( ) <EOL> created = DateTimeField ( ) <EOL> class Like ( EmbeddedDocument ) : <EOL> uid = StringField ( required = True ) <EOL> avatar = URLField ( ) <EOL> class Geo ( EmbeddedDocument ) : <EOL> longtitude = FloatField ( ) <EOL> latitude = FloatField ( ) <EOL> location = StringField ( ) <EOL> class MicroBlog ( Document ) : <EOL> mid = StringField ( required = True ) <EOL> uid = StringField ( required = True ) <EOL> content = StringField ( ) <EOL> omid = StringField ( ) <EOL> forward = StringField ( ) <EOL> created = DateTimeField ( ) <EOL> geo = EmbeddedDocumentField ( Geo ) <EOL> n_likes = IntField ( ) <EOL> likes = ListField ( EmbeddedDocumentField ( Like ) ) <EOL> n_forwards = IntField ( ) <EOL> forwards = ListField ( EmbeddedDocumentField ( Forward ) ) <EOL> n_comments = IntField ( ) <EOL> comments = ListField ( EmbeddedDocumentField ( Comment ) ) <EOL> meta = { <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] } <EOL> ] <EOL> } <EOL> class EduInfo ( EmbeddedDocument ) : <EOL> name = StringField ( ) <EOL> date = StringField ( ) <EOL> detail = StringField ( ) <EOL> class WorkInfo ( EmbeddedDocument ) : <EOL> name = StringField ( ) <EOL> date = StringField ( ) <EOL> location = StringField ( ) <EOL> position = StringField ( ) <EOL> detail = StringField ( ) <EOL> class UserInfo ( EmbeddedDocument ) : <EOL> nickname = StringField ( ) <EOL> avatar = URLField ( ) <EOL> location = StringField ( ) <EOL> sex = BooleanField ( ) <EOL> birth = StringField ( ) <EOL> blog = URLField ( ) <EOL> site = URLField ( ) <EOL> intro = StringField ( ) <EOL> email = EmailField ( ) <EOL> qq = StringField ( ) <EOL> msn = StringField ( ) <EOL> n_follows = IntField ( ) <EOL> n_fans = IntField ( ) <EOL> edu = ListField ( EmbeddedDocumentField ( EduInfo ) ) <EOL> work = ListField ( EmbeddedDocumentField ( WorkInfo ) ) <EOL> tags = ListField ( StringField ( ) ) <EOL> class Friend ( EmbeddedDocument ) : <EOL> uid = StringField ( ) <EOL> nickname = StringField ( ) <EOL> sex = BooleanField <EOL> class WeiboUser ( Document ) : <EOL> uid = StringField ( required = True ) <EOL> last_update = DateTimeField ( ) <EOL> newest_mids = ListField ( StringField ( ) ) <EOL> info = EmbeddedDocumentField ( UserInfo ) <EOL> follows = ListField ( EmbeddedDocumentField ( Friend ) ) <EOL> fans = ListField ( EmbeddedDocumentField ( Friend ) ) <EOL> meta = { <EOL> '<STR_LIT>' : shard_key <EOL> } </s>
