# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def YesNo(b):
#   if b:
#     return xlt("Yes")
#   else:
#     return xlt("No")
# 
# def prettyDate(val, long=True):
#   if isinstance(val, datetime.datetime):
#     val=val.timetuple()
#   if not isinstance(val, time.struct_time):
#     val=time.localtime(val)
#   if long:
#     return time.strftime("%Y-%m-%d %H:%M:%S", val)
#   else:
#     return time.strftime("%Y-%m-%d", val)


import adm
from wh import xlt, YesNo, prettyDate
        FROM pg_roles u ORDER BY rolname""")
    if set:
      for row in set:
        if not row:
          break
        instances.append(Role(parentNode, row['name'], row.getDict()))
    return instances
  
  def __init__(self, parentNode, name, info):
    super(Role, self).__init__(parentNode, name)
    self.info=info
    
  def GetIcon(self):
    icons=[]
    if self.info['members']:
      icons.append("Group")
    else:
      icons.append("User")
    return self.GetImageId(icons)
  
  
  def GetProperties(self):
    if not len(self.properties):

      self.properties = [
        (xlt("Name"), self.name, self.GetImageId('Role')),
        (    "OID",   self.info['oid']),
        (xlt("Can Login"), YesNo(self.info['rolcanlogin'])),
        (xlt("Superuser"), YesNo(self.info['rolsuper'])),
        (xlt("Catalog Update"), YesNo(self.info['rolcatupdate'])),

# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def YesNo(b):
#   if b:
#     return xlt("Yes")
#   else:
#     return xlt("No")
# 
# def prettyDate(val, long=True):
#   if isinstance(val, datetime.datetime):
#     val=val.timetuple()
#   if not isinstance(val, time.struct_time):
#     val=time.localtime(val)
#   if long:
#     return time.strftime("%Y-%m-%d %H:%M:%S", val)
#   else:
#     return time.strftime("%Y-%m-%d", val)


# Path: modPg/Role.py
import adm
from wh import xlt, YesNo, prettyDate

        FROM pg_roles u ORDER BY rolname""")
    if set:
      for row in set:
        if not row:
          break
        instances.append(Role(parentNode, row['name'], row.getDict()))
    return instances
  
  def __init__(self, parentNode, name, info):
    super(Role, self).__init__(parentNode, name)
    self.info=info
    
  def GetIcon(self):
    icons=[]
    if self.info['members']:
      icons.append("Group")
    else:
      icons.append("User")
    return self.GetImageId(icons)
  
  
  def GetProperties(self):
    if not len(self.properties):

      self.properties = [
        (xlt("Name"), self.name, self.GetImageId('Role')),
        (    "OID",   self.info['oid']),
        (xlt("Can Login"), YesNo(self.info['rolcanlogin'])),
        (xlt("Superuser"), YesNo(self.info['rolsuper'])),
        (xlt("Catalog Update"), YesNo(self.info['rolcatupdate'])),

        (xlt("Create DB"), YesNo(self.info['rolcreatedb'])),