Exemple #1
0
 def __init__(self, **kw):
     super(MarkdownCache, self).__init__(
         fields=dict(
             md5=S.String(),
             html=S.String(),
             render_time=S.Float()),
         **kw)
Exemple #2
0
class WikiPage(MappedClass):
    class __mongometa__:
        session = session
        name = 'wiki_page'

    _id = FieldProperty(schema.ObjectId)
    title = FieldProperty(schema.String(required=True))
    text = FieldProperty(schema.String(if_missing=''))
class Qualification(MappedClass, EnhancingClass):
    class __mongometa__:
        session = session
        name = collection_name

    _id = FieldProperty(schema.ObjectId)
    name = FieldProperty(schema.String(required=True))

    description = FieldProperty(schema.String(if_missing=''))
    rendered_services = StringForeignKeyListProperty(Service)
Exemple #4
0
class PremiumSize(MappedClass, EnhancingClass):
    class __mongometa__:
        session = session
        name = collection_name
        extensions = [PremiumSizeTriggers]

    _id = FieldProperty(schema.ObjectId)
    name = FieldProperty(schema.String(required=True))
    min = FieldProperty(schema.Float(required=True))
    max = FieldProperty(schema.Float(required=True))
    description = FieldProperty(schema.String(if_missing=''))
Exemple #5
0
class Client(MappedClass, EnhancingClass):
    class __mongometa__:
        session = session
        name = collection_name

    _id = FieldProperty(schema.ObjectId)
    name = FieldProperty(schema.String(required=True))
    surname = FieldProperty(schema.String(required=True))
    sex = SexProperty()
    address = FieldProperty(schema.String(required=True))
    login = FieldProperty(schema.String(required=True))
    passwd = PasswordProperty()

    patronymic = FieldProperty(schema.String(if_missing=''))
    avatar = ImageProperty()
Exemple #6
0
class TaskState(Document):
    class __mongometa__:
        name = 'chapman.task'
        session = doc_session
        indexes = [
            [('parent_id', 1), ('data.composite_position', 1)],
        ]

    _id = Field(int, if_missing=lambda: getrandbits(63))
    type = Field(str)
    parent_id = Field(int, if_missing=None)
    status = Field(str, if_missing='pending')
    _result = Field('result', S.Binary)
    data = Field({str: None})
    options = Field(
        dict(
            queue=S.String(if_missing='chapman'),
            priority=S.Int(if_missing=10),
            immutable=S.Bool(if_missing=False),
            ignore_result=S.Bool(if_missing=False),
            semaphores=[str],
        ))
    on_complete = Field(int, if_missing=None)
    mq = Field([int])

    result = pickle_property('_result')

    @classmethod
    def set_result(cls, id, result):
        cls.m.update_partial(
            {'_id': id},
            {'$set': {
                'result': dumps(result),
                'status': result.status
            }})
Exemple #7
0
class Character(MappedClass):
    class __mongometa__:
        session = DBSession
        name = 'character'

    def __init__(self, name, characClass, race, armor_class, attrs, attrsMods):
        self.name = name
        self.charClass = characClass
        self.race = race
        self.armorClass = armor_class
        self.attributes = attrs
        self.attributeModifiers = attrsMods

    def convertToForm(self):
        attrs = {
            'id':
            self._id,
            'name':
            self.name,
            'character_class':
            self.charClass,
            'race':
            self.race,
            'armor_class':
            self.armorClass,
            'strength_val':
            str(self.attributes[Attributes.Strength.value]),
            'strength_modifier':
            str(self.attributeModifiers[Attributes.Strength.value]),
            'dexterity_val':
            str(self.attributes[Attributes.Dexterity.value]),
            'dexterity_modifier':
            str(self.attributeModifiers[Attributes.Dexterity.value]),
            'const_val':
            str(self.attributes[Attributes.Constitution.value]),
            'const_modifier':
            str(self.attributeModifiers[Attributes.Constitution.value]),
            'intell_val':
            str(self.attributes[Attributes.Intellect.value]),
            'intell_modifier':
            str(self.attributeModifiers[Attributes.Intellect.value]),
            'wisdom_val':
            str(self.attributes[Attributes.Wisdom.value]),
            'wisdom_modifier':
            str(self.attributeModifiers[Attributes.Wisdom.value]),
            'charisma_val':
            str(self.attributes[Attributes.Charisma.value]),
            'charisma_modifier':
            str(self.attributeModifiers[Attributes.Charisma.value])
        }

        return attrs

    _id = FieldProperty(schema.ObjectId)
    name = FieldProperty(schema.String(required=True))
    charClass = FieldProperty(schema.String)
    race = FieldProperty(schema.String)
    armorClass = FieldProperty(schema.Int)
    attributes = FieldProperty(schema.Array(int))
    attributeModifiers = FieldProperty(schema.Array(int))
Exemple #8
0
class WorkerState(MappedClass, EnhancingClass):
    class __mongometa__:
        session = session
        name = collection_name

    _id = FieldProperty(schema.ObjectId)
    name = FieldProperty(schema.String(required=True))

    description = FieldProperty(schema.String(if_missing=''))


#worker_state_1 = WorkerState(name = "basic")
#worker_state_2 = WorkerState(name = "ill")
#worker_state_3 = WorkerState(name = "rest")

#session.flush_all()