Exemplo n.º 1
0
 def add_company(self, name, user):
     """
         Add a company 'name' in the database
         ( set its goal by default )
     """
     log.info(u"Adding company : %s" % name)
     company = Company()
     company.name = name
     company.goal = u"Entreprise de {0}".format(format_account(user))
     company.contribution = self.request.config.get('contribution_cae')
     company = self.dbsession.merge(company)
     self.dbsession.flush()
     return company
Exemplo n.º 2
0
 def _add_company(self, name, user):
     """
         Add a company 'name' in the database
         ( set its goal by default )
     """
     logger.info(u"Adding company : %s" % name)
     company = Company()
     company.name = name
     company.goal = u"Entreprise de {0}".format(
         format_account(user, reverse=False))
     company.contribution = self.request.config.get('contribution_cae')
     company = self.dbsession.merge(company)
     self.dbsession.flush()
     return company
Exemplo n.º 3
0
def add_company(user, company_name, goal=""):
    company = Company()
    company.name = company_name
    company.goal = goal or u"Entreprise de %s" % user.login

    user.companies.append(company)

    session = DBSESSION()
    session.add(company)

    session.flush()

    print "Added company for %s: %s" % (user.login, company_name)

    return company