def get_roles(user=None, with_standard=True):
 if (not user):
  user = frappe.session.user
 if (user == u'Guest'):
  return [u'Guest']
 def get():
  return ([r[0] for r in frappe.db.sql(u"select role from tabUserRole\n DCTB  DCTB  DCTB where parent=%s and role not in ('All', 'Guest')", (user,))] + [u'All', u'Guest'])
 roles = frappe.cache().hget(u'roles', user, get)
 if (not with_standard):
  roles = filter((lambda x: (x not in [u'All', u'Guest', u'Administrator'])), roles)
 return roles

def get_roles ( user = None , with_standard = True ) : if ( not user ) : user = frappe . session . user if ( user == u'Guest' ) : return [ u'Guest' ] def get ( ) : return ( [ r [ 0 ] for r in frappe . db . sql ( u"select role from tabUserRole\n DCTB  DCTB  DCTB where parent=%s and role not in ('All', 'Guest')" , ( user , ) ) ] + [ u'All' , u'Guest' ] ) roles = frappe . cache ( ) . hget ( u'roles' , user , get ) if ( not with_standard ) : roles = filter ( ( lambda x : ( x not in [ u'All' , u'Guest' , u'Administrator' ] ) ) , roles ) return roles
returns roles of current user .