Parent: [78ab8f] (diff)

Child: [85f2d2] (diff)

Download this file

wiki.py    18 lines (15 with data), 571 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
Quick Ming Example
=========================
Here is some sample code from a TG project that uses ming::
class Artifact(Document):
class __mongometa__:
session = ProjectSession(Session.by_name('main'))
name='artifact'
# Artifact base schema
_id = Field(S.ObjectId)
project_id = Field(S.String, if_missing=lambda:c.project._id)
plugin_verson = Field(
S.Object,
{ str: str },
if_missing=lambda:{c.app.config.name:c.app.__version__})
acl = Field({str:[str]})