예제 #1
0
def search_elements(app_name, userinfo=None, project=None, page=None, item=None, attribute=None, tags=None, datetime1=None, datetime2=None, order=True):
  q = BulbwareElement.query(BulbwareElement.app_name==app_name)
  #
  if userinfo:
    q = q.filter(BulbwareElement.owner==bulbware_lib.get_key(userinfo, user_model.UserInfo))
  #
  if project:
    q = q.filter(BulbwareElement.project==bulbware_lib.get_key(project, BulbwareProject))
  #
  if page:
    q = q.filter(BulbwareElement.page==bulbware_lib.get_key(page, BulbwarePage))
  #
  if item:
    q = q.filter(BulbwareElement.item==bulbware_lib.get_key(item, BulbwareItem))
  #
  if attribute:
    q = q.filter(BulbwareElement.attribute==bulbware_lib.get_key(attribute, BulbwareAttribute))
  #
  if tags:
    while tags.count('') > 0:
      tags.remove('')
    if tags and (len(tags) > 0):
      q = q.filter(BulbwareElement.tags.IN(tags))
  #
  if datetime1:
    q = q.filter(BulbwareElement.element_datetime>=bulbware_lib.get_datetime(datetime1))
  if datetime2:
    q = q.filter(BulbwareElement.element_datetime<=bulbware_lib.get_datetime(datetime2))
  #
  if order:
    return q.order(BulbwareElement.sorttext)
  else:
    return q
예제 #2
0
 def save(self, options, tags, sorttext=None, element_datetime=None, project=None, page=None, item=None, attribute=None):
     self.options = options
     self.tags = tags
     if sorttext:
       self.sorttext = sorttext
     else:
       self.sorttext = element_datetime
     if element_datetime:
       self.element_datetime = bulbware_lib.utc_date(bulbware_lib.parse_datetime(element_datetime))
     else:
       self.element_datetime = None
     self.project = bulbware_lib.get_key(project, BulbwareProject)
     self.page = bulbware_lib.get_key(page, BulbwarePage)
     self.item = bulbware_lib.get_key(item, BulbwareItem)
     self.attribute = bulbware_lib.get_key(attribute, BulbwareAttribute)
     self.put()
예제 #3
0
 def save(self, name, options, tags, sorttext=None, project_key=None):
   self.name = name
   self.options = options
   self.tags = tags
   if sorttext:
     self.sorttext = sorttext
   else:
     self.sorttext = name
   self.project = bulbware_lib.get_key(project_key, BulbwareProject)
   self.put()
예제 #4
0
def search_items(app_name, userinfo=None, project=None, tags=None, order=True):
  q = BulbwareItem.query(BulbwareItem.app_name==app_name)
  #
  if userinfo:
    q = q.filter(BulbwareItem.owner==bulbware_lib.get_key(userinfo, user_model.UserInfo))
  #
  if project:
    q = q.filter(BulbwareItem.project==bulbware_lib.get_key(project, BulbwareProject))
  #
  if tags:
    while tags.count('') > 0:
      tags.remove('')
    if tags and (len(tags) > 0):
      q = q.filter(BulbwareItem.tags.IN(tags))
  #
  if order:
    return q.order(BulbwareItem.sorttext)
  else:
    return q