def org_site_has_assets(row, tablename='org_facility'):
 if (not current.deployment_settings.has_module('asset')):
  return False
 if hasattr(row, tablename):
  row = row[tablename]
 try:
  id = row.id
 except AttributeError:
  return None
 s3db = current.s3db
 atable = s3db.asset_asset
 stable = s3db[tablename]
 query = (((atable.deleted != True) & (stable.id == id)) & (atable.site_id == stable.site_id))
 asset = current.db(query).select(atable.id, limitby=(0, 1)).first()
 if asset:
  return True
 else:
  return False

def org_site_has_assets ( row , tablename = 'org_facility' ) : if ( not current . deployment_settings . has_module ( 'asset' ) ) : return False if hasattr ( row , tablename ) : row = row [ tablename ] try : id = row . id except AttributeError : return None s3db = current . s3db atable = s3db . asset_asset stable = s3db [ tablename ] query = ( ( ( atable . deleted != True ) & ( stable . id == id ) ) & ( atable . site_id == stable . site_id ) ) asset = current . db ( query ) . select ( atable . id , limitby = ( 0 , 1 ) ) . first ( ) if asset : return True else : return False
whether a site has assets .