Skip to content

Instantly share code, notes, and snippets.

@zhangchunlin
Last active December 4, 2015 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangchunlin/d850834b0abf2663c746 to your computer and use it in GitHub Desktop.
Save zhangchunlin/d850834b0abf2663c746 to your computer and use it in GitHub Desktop.
linci.artifact models
#! /usr/bin/env python
#coding=utf-8
from uliweb.orm import *
import logging
log = logging.getLogger('linci.artifact')
class LinciArtifact(Model):
#artifact id = "%s-%s"%(asite,aindex)
#artifact site
asite = Field(str)
#artifact index
aindex = Field(int)
#artifact type
type = Field(int)
#project
project = Field(str)
#artifact status
status = Field(int, choices=get_var('LINCI/ARTIFACT_STATUS'))
released = Field(bool, default= False)
removed = Field(bool, default= False)
#create date
cdate = Field(datetime.datetime, auto_now_add=True)
#ext properties
extprops = Field(JSON, default={})
class LinciArtifactProperty(Model):
artifact = Reference("linciartifact", nullable=False, collection_name='props')
key = Field(str, index=True)
value = Field(str)
class LinciArtifactFile(Model):
artifact = Reference("linciartifact", nullable=False, collection_name='files')
#relative path
path = Field(str)
#size in bytes
size = Field(int)
md5 = Field(str)
[LINCI]
ARTIFACT_STATUS = [
(1, 'updating'),
(2, 'fixed'),
(3, 'released'),
]
ARTIFACT_STATUS_UPDATING = 1
ARTIFACT_STATUS_FIXED = 2
ARTIFACT_STATUS_RELEASED = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment