(self, curs, new_name = None)
return "\n".join(sql_list)
Generate creation SQL.
Generate creation SQL.
Generate creation SQL .
def get_create_sql(self, curs, new_name = None):
        """Generate creation SQL."""
        if not new_name:
            new_name = self.name

        qtarget = quote_fqident(new_name)

        sql_list = []
        for role, acl, who in self.acl_list:
            qrole = quote_ident(role)
            astr1, astr2 = self.acl_to_grants(acl)
            if astr1:
                sql = "GRANT %s ON %s\n  TO %s;" % (astr1, qtarget, qrole)
                sql_list.append(sql)
            if astr2:
                sql = "GRANT %s ON %s\n  TO %s WITH GRANT OPTION;" % (astr2, qtarget, qrole)
                sql_list.append(sql)
        return "\n".join(sql_list)
def get_create_sql ( self , curs , new_name = None ) : if not new_name : new_name = self . name qtarget = quote_fqident ( new_name ) sql_list = [ ] for role , acl , who in self . acl_list : qrole = quote_ident ( role ) astr1 , astr2 = self . acl_to_grants ( acl ) if astr1 : sql = "GRANT %s ON %s\n  TO %s;" % ( astr1 , qtarget , qrole ) sql_list . append ( sql ) if astr2 : sql = "GRANT %s ON %s\n  TO %s WITH GRANT OPTION;" % ( astr2 , qtarget , qrole ) sql_list . append ( sql ) return "\n" . join ( sql_list )