def run_project(args):
    options = Options()
    options.parse(args[1:])

    project = Project(options)

    print 'Archirtecture chosen:', project.print_arg()
Beispiel #2
0
def start(args):
    options = Options()
    options.parse(args)

    project = Project(options)

    project.run()
def run(args):
    options = Options()
    options.parse(args[1:])

    project = Project(options)

    print 'Architecture chosen:', project.print_arg()
    project.run_command()
Beispiel #4
0
def run_project(args):
    options = Options()
    options.parse(args[1:])

    project = Project(options)

    print 'Printing date:', project.date()
    print 'Printing example arg:', project.print_example_arg()
def run_project(args):
    options = Options()
    options.parse(args[1:])

    project = Project(options)

    print 'Printing date:', project.date()
    print 'Printing example arg:', project.print_example_arg()
class TestProject(unittest.TestCase):
    def _default_options(self):
        options = Options()
        opts = options.parse()
        return opts

    def setUp(self):
        self.machine = Project(self._default_options())
        self.mock_process = mock()
        self.machine.process = self.mock_process

    def test_machine_should_get_date(self):
        self.machine.date()
        verify(self.mock_process).execute('date')
Beispiel #7
0
 def get(self):
     for i in range(100):
         project = Project()
         project.title = str(random.randrange(20, 10000))
         project.authenticity = False
         project.description = str(
             random.randrange(1, 100000000000000000000))
         project.ngo = str(random.randrange(1, 10))
         project.category = "Health"
         project.put()
     self.response.write("Done!")
Beispiel #8
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
			userAuth = User.query(User.userid == userid).fetch(1)
			ngoAuth = NGO.query(NGO.userid == userid).fetch(1)
			if userAuth:
				userProj = []
				link = userAuth[0].projects
				for p in link:
					ngo, title = p[0].split("_")
					projects = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if projects:
						userProj.append((projects[0],p[1]));
						print userProj
				parameter = {"proj":userProj, "user": 1, "length":len(userProj)}
				self.render("/userProjects.html",parameter)
			elif ngoAuth:
				ngoProjects = []
				link = ngoAuth[0].projects
				for p in link:
					proj = Project.query(Project.ngo == p.userid).fetch(1)
					ngoProjects.append(proj[0]);
				parameter = {"projects":ngoProjects, "user": 0, "length":len(ngoProjects),"ngo":ngoAuth[0]}
				self.render("/ngoProjects.html",parameter)
		else:
			self.render("/login.html")
Beispiel #9
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
			userAuth = User.query(User.userid == userid).fetch(1)
			ngoAuth = NGO.query(NGO.userid == userid).fetch(1)
			if userAuth:
				userProj = []
				link = userAuth[0].projects
				for p in link:
					ngo, title = p[0].split("_")
					projects = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if projects:
						userProj.append((projects[0],p[1]));
						print userProj
				parameter = {"proj":userProj, "user": 1, "length":len(userProj)}
				self.render("/userProjects.html",parameter)
			elif ngoAuth:
				ngoProjects = []
				ngoAuth
				for p in ngoAuth:
					proj = Project.query(Project.ngo == p.userid).fetch(1)
					ngoProjects.append(proj[0]);
				print ngoAuth[0]
				parameter = {"ngoProjects":ngoProjects, "user": 0, "length":len(ngoProjects),"ngo":ngoAuth[0]}
				self.render("/ngoProjects.html",parameter)
		else:
			self.render("/login.html")
        def post(self, urlParameter):
		ngoUserid, title = urlParameter.split("_")
                descriptionAuthenticity = self.request.get("descriptionAuthenticity")
                projectQuery = Project.query(Project.ngo == ngoUserid, Project.title == title)
		ngoQuery = NGO.query(NGO.userid == ngoUserid)
		ngo = ngoQuery.fetch(1)[0]
                project = projectQuery.fetch(1)[0]
		parameter = {}
                if descriptionAuthenticity == "on":
                        mail.send_mail(sender=" <*****@*****.**>",
                                       	          to= "<"+ngo.email+">",
	                                         	subject="Your Project  has passed authentication test",
	                                                body="""Dear :"""+ ngo.name + "Your Project titled '"+project.title+"' has passed authentication and goes live!\n" +"""Please let us know if you have any questions.The csr.com Team""")
			project.authenticity = True
			project.put()
			parameter["message"]= "Success Mail Sent!"
   		        self.render("responseAdmin.html", parameter)


                else:
                	failiureReport = "\nPlaces where your project failed\n"
                        failiureReport += " The Description you provided isnt apt for a site like us.\n"
                        mail.send_mail(sender=" <*****@*****.**>", to= "<"+ngo.email+">", subject="Your Project has failed authentication test",body="""Dear :"""+ ngo.name + failiureReport +"""Please let us know if you have any questions. \nThe csr.com Team""")

			parameter["message"]= "Failure Report Sent!"
        	        self.render("responseAdmin.html", parameter)
        def get(self, urlParameter):
		ngo, title = urlParameter.split("_")
                parameter = {}
                projectQuery = Project.query(Project.ngo == ngo, Project.title == title)
                project = projectQuery.fetch(1)[0]
                parameter["project"] = project
                self.render("adminAuthenticateProjectPage.html", parameter)
Beispiel #12
0
	def get(self):
		user=users.get_current_user()
		try:
			hitCount = HitCount.query().fetch(1)[0]
			hits = int(hitCount.hitCount) + 1
		except:
			hits = 0
			hitCount = HitCount()
		hitCount.hitCount = str(hits)
		hitCount.put()
		if user:
			userid = user.user_id()
 	    		userAuthenticationQuery = User.query(User.userid == userid).fetch(1)	 	    	      
                        NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
                        if (not userAuthenticationQuery) and (not NGOauthenticationQuery) :
				self.redirect("/signup/registration")
		projects = Project.query().fetch()
		randProjects = []
		try:
			for i in range(0,4):
				randomInt = randint(0,len(projects)-1)
				if projects[randomInt] not in randProjects:
					randProjects.append(projects[randomInt])
		except:
			pass
		parameter = {"projects" : randProjects, "hits":hits}
		self.render('frontPage.html', parameter)        
 def get(self):
     user = users.get_current_user()
     try:
         hitCount = HitCount.query().fetch(1)[0]
         hits = int(hitCount.hitCount) + 1
     except:
         hits = 0
         hitCount = HitCount()
     hitCount.hitCount = str(hits)
     hitCount.put()
     if user:
         userid = user.user_id()
         userAuthenticationQuery = User.query(
             User.userid == userid).fetch(1)
         NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
         if (not userAuthenticationQuery) and (not NGOauthenticationQuery):
             self.redirect("/signup/registration")
     projects = Project.query().fetch()
     randProjects = []
     try:
         for i in range(0, 4):
             randomInt = randint(0, len(projects) - 1)
             if projects[randomInt] not in randProjects:
                 randProjects.append(projects[randomInt])
     except:
         pass
     parameter = {"projects": randProjects, "hits": hits}
     self.render('frontPage.html', parameter)
class TestProject(unittest.TestCase):
  def _default_options(self):
    options = Options()
    opts, args = options.parse()
    
    return opts
  
  def setUp(self):
    self.machine = Project(self._default_options())

    self.mock_process = MockProcess()
    self.machine.process = self.mock_process
  
  def test_machine_should_get_date(self):
    self.machine.date()
    
    self.assertTrue("date" in self.mock_process.commands)
Beispiel #15
0
 def get(self, urlParameter):
     ngo, title = urlParameter.split("_")
     parameter = {}
     projectQuery = Project.query(Project.ngo == ngo,
                                  Project.title == title)
     project = projectQuery.fetch(1)[0]
     parameter["project"] = project
     self.render("adminAuthenticateProjectPage.html", parameter)
class TestProject(unittest.TestCase):
    def _default_options(self):
        options = Options()
        opts, args = options.parse()

        return opts

    def setUp(self):
        self.machine = Project(self._default_options())

        self.mock_process = MockProcess()
        self.machine.process = self.mock_process

    def test_machine_should_get_date(self):
        self.machine.date()

        self.assertTrue("date" in self.mock_process.commands)
	def get(self):
		for i in range(100):
               	        project = Project()
                	project.title = str(random.randrange(20,10000))
                       	project.authenticity = False
                	project.description = str(random.randrange(1,100000000000000000000))
                        project.ngo = str(random.randrange(1,10))
			project.category = "Health"
              	        project.put()
	    	self.response.write("Done!")
Beispiel #18
0
 def post(self):
         detailedDescription = self.request.get("detailedDescription")
         
         count=int(self.request.get("count"))
         projectObject = Project()
         user=users.get_current_user()
         if user:
                 userid = user.user_id()
                 authenticationUser = User.query(User.userid==userid).fetch(1)
                 authenticationNGO = NGO.query(NGO.userid==userid).fetch(1)
                 if authenticationNGO:
                         ngo = projectObject.ngo
                         existingProject = Project.query(Project.ngo==userid).fetch(1)
                         if existingProject:
                                 projectObject.detailedDescription = detailedDescription
                                 while count>0:
                                         j=1
                                         Counter=str(count-count+j)
                                         taskTitle = self.request.get("taskTitle"+Counter)
                                         taskDescription = self.request.get("taskDescription"+Counter)
                                         taskFund = self.request.get("taskFund"+Counter)
                                         count=count-1
                                         j=j-1
                                         projectObject.tasks = [TaskList(taskTitle = taskTitle, taskDescription = taskDescription, taskFund = taskFund)]
                                 projectObject.put()
                                 self.redirect("/home")
                         else:
                                 self.redirect("/propose")
                 elif authenticationUser:
                         self.redirect("/home")
                 else:
                         self.redirect("/")
         else:
                 self.redirect("/login")
        def post(self):
                shortDescription = self.request.get("shortDescription")
		user = users.get_current_user()
		userid = user.user_id()
		title = self.request.cookies.get("title", "")
                project = Project.query(Project.ngo == userid, Project.title == title).fetch(1)[0]
		project.shortDescription = shortDescription             
		project.put()
		self.redirect("/propose/project/taskList")
Beispiel #20
0
 def get(self):
     user = users.get_current_user()
     if user:
         userid = user.user_id()
         userAuthentication = User.query(User.userid == userid).fetch(1)
         ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
         if userAuthentication:
             parameter = {}
             ngos = NGO.query().fetch(4)
             userObject = userAuthentication[0]
             userProjects = []
             for p in userObject.projects:
                 ngo, title = p[0].split("_")
                 print p[0]
                 proj = ndb.gql(
                     "SELECT * FROM Project WHERE link = :1 AND ngo = :2",
                     title, ngo).fetch(1)
                 if proj:
                     userProjects.append(proj[0])
             projects = Project.query().fetch(100)
             print userObject.projects
             closeProjects = []
             decorated = [(project,
                           project.distance(userAuthentication[0].lat,
                                            userAuthentication[0].lng))
                          for project in projects]
             closeProjects = sorted(decorated, key=lambda tup: tup[1])[0:4]
             parameter["projects"] = closeProjects
             parameter["userProjects"] = userProjects
             parameter["ngos"] = ngos
             parameter["currUser"] = userAuthentication[0]
             self.render("userHomePage.html", parameter)
         elif ngoAuthentication:
             parameter = {}
             proj = Project.query(
                 Project.ngo == ngoAuthentication[0].userid).fetch()
             parameter["ngoProjects"] = proj
             parameter["length"] = len(proj)
             parameter["ngo"] = ngoAuthentication[0]
             self.render("ngoHomePage.html", parameter)
         else:
             self.redirect("/signup/registration")
     else:
         self.redirect("/")
Beispiel #21
0
 def post(self):
     shortDescription = self.request.get("shortDescription")
     user = users.get_current_user()
     userid = user.user_id()
     title = self.request.cookies.get("title", "")
     project = Project.query(Project.ngo == userid,
                             Project.title == title).fetch(1)[0]
     project.shortDescription = shortDescription
     project.put()
     self.redirect("/propose/project/taskList")
Beispiel #22
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
 	    		userAuthenticationQuery = User.query(User.userid == userid).fetch(1)	 	    	      
                        NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
                        if (not userAuthenticationQuery) and (not NGOauthenticationQuery) :
				self.redirect("/signup/registration")
		projects = Project.query().fetch(3)
		parameter = {"projects" : projects }
		self.render('frontPage.html', parameter)        
Beispiel #23
0
 def post(self):
     category = self.request.get("category")
     title = self.request.get("title")
     user = users.get_current_user()
     userid = user.user_id()
     projectObject = Project()
     projectObject.ngo = userid
     projectObject.category = category
     projectObject.title = title
     projectObject.authenticity = False
     projectObject.put()
     self.response.headers.add_header("Set-Cookie", str("title=%s" % title))
     sleep(5)
     self.redirect("/propose/project")
 def post(self):
         detailedDescription = self.request.get("detailedDescription")
         
         count=int(self.request.get("count"))
         projectObject = Project()
         user=users.get_current_user()
         if user:
                 userid = user.user_id()
                 authenticationUser = User.query(User.userid==userid).fetch(1)
                 authenticationNGO = NGO.query(NGO.userid==userid).fetch(1)
                 if authenticationNGO:
                         ngo = projectObject.ngo
                         existingProject = Project.query(Project.ngo==userid).fetch(1)
                         if existingProject:
                                 projectObject.detailedDescription = detailedDescription
                                 while count>0:
                                         j=1
                                         Counter=str(count-count+j)
                                         taskTitle = self.request.get("taskTitle"+Counter)
                                         taskDescription = self.request.get("taskDescription"+Counter)
                                         taskFund = self.request.get("taskFund"+Counter)
                                         count=count-1
                                         j=j-1
                                         projectObject.tasks = [TaskList(taskTitle = taskTitle, taskDescription = taskDescription, taskFund = taskFund)]
                                 projectObject.put()
                                 self.redirect("/home")
                         else:
                                 self.redirect("/propose")
                 elif authenticationUser:
                         self.redirect("/home")
                 else:
                         self.redirect("/")
         else:
                 self.redirect("/login")
Beispiel #25
0
        def get(self):
		user = users.get_current_user()
		if user:
			title = self.request.cookies.get("title", None)
			userid = user.user_id()
			project = Project.query(Project.ngo == userid, Project.title == title).fetch(1)[0]
			if project:
				self.render("project.html")
			else:
				self.redirect("/propose")
			
		else:
			self.redirect("/login")
Beispiel #26
0
	def post(self):
		parameter = {}
		lat = self.request.get("lat")
		lng = self.request.get("lng")
		print lat, lng
		projects = Project.query().fetch()
		decorated = [(project,project.distance(lat,lng)) for project in projects if project.distance(lat,lng)<1.00]
		closeProjects = sorted(decorated, key=lambda tup: tup[1])
		parameter["closeProjects"] = closeProjects
		parameter["get"] = 0
		parameter["search"] = self.request.get("address")
		parameter["length"] = len(parameter["closeProjects"])
		self.render('explore.html',parameter)
        def get(self):
		user = users.get_current_user()
		if user:
			title = self.request.cookies.get("title", None)
			userid = user.user_id()
			project = Project.query(Project.ngo == userid, Project.title == title).fetch(1)[0]
			if project:
				self.render("project.html")
			else:
				self.redirect("/propose")
			
		else:
			self.redirect("/login")
Beispiel #28
0
    def get(self, urlParameter):
		q = NGO.query(NGO.userid == urlParameter).fetch(1)
		if q:
			parameters = {}
			for p in q:
				parameters["ngo"] = p
			q = Project.query(Project.ngo == urlParameter).fetch(4)
			parameters["projects"] = q
			parameters["p_len"] = len(q)
			q = NGO.query(NGO.userid != urlParameter and NGO.sectorOfOperation == parameters["ngo"].sectorOfOperation).fetch(4)
			parameters["similarNGOs"] = q
			parameters["n_len"] = len(q)
			self.render('ngoPage.html',parameters)
Beispiel #29
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication =  User.query(User.userid == userid).fetch(1)
			ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter = {}
				ngos = NGO.query().fetch(4)
				userObject = userAuthentication[0]
				userProjects = []
				for p in userObject.projects:
					ngo, title = p[0].split("_")
					print p[0]
					proj = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if proj:
						userProjects.append(proj[0]);
				projects = Project.query().fetch(100)
				print userObject.projects
				cProjects = []
				decorated = [(project,project.distance(userAuthentication[0].lat,userAuthentication[0].lng)) for project in projects if project.distance(userAuthentication[0].lat,userAuthentication[0].lng)<50]
				print decorated
				cProjects = sorted(decorated, key=lambda tup: tup[1])[0:4] 
				parameter["cProjects"] = cProjects
				parameter["userProjects"] = userProjects 
				parameter["ngos"] = ngos
				parameter["currUser"] = userAuthentication[0]
				self.render("userHomePage.html", parameter)
			elif ngoAuthentication:
				parameter={}
				proj = Project.query(Project.ngo == ngoAuthentication[0].userid).fetch()
                                parameter["ngoProjects"] = proj
                                parameter["length"] = len(proj)
                                parameter["ngo"]=ngoAuthentication[0]
				self.render("ngoHomePage.html", parameter)
			else:
				self.redirect("/signup/registration")
		else:
			self.redirect("/")
Beispiel #30
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication =  User.query(User.userid == userid).fetch(1)
			ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter = {}
				ngos = NGO.query().fetch(3)
				userObject = userAuthentication[0]
                                projectsIdentifier = userObject.projects[:3]
                                userProjects = []
                                for projectIdentifier in projectsIdentifier:
                                        key = ndb.Key("Project", projectIdentifier)
                                        userProjects.append(key.get())
				projects = Project.query().fetch(3)
                                parameter["projects"] = projects
				parameter["userProjects"] = userProjects 
				parameter["ngos"] = ngos
				self.render("userHomePage.html", parameter)
			elif ngoAuthentication:
				parameter={}
                                ngo = ngoAuthentication[0]
                                projectsIdentifierList = ngo.projects
                                ngoProjects = []
				if projectsIdentifierList:
                             		for projectIdentifier in projectsIdentifierList:
                                	        ngo, title = self.stripProjectIdentifier(projectIdentifier)
                                       	        projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
                                        	ngoProjects.append(projectObject)
                                parameter["ngoProjects"] = ngoProjects
				self.render("ngoHomePage.html", parameter)
			else:
				self.redirect("/signup/registration")
		else:
			self.redirect("/")
Beispiel #31
0
    def get(self, urlParameter):
		q = NGO.query(NGO.userid == urlParameter).fetch(1)
		if q:
			parameters = {}
			for p in q:
				parameters["ngo"] = p
			q = Project.query(Project.ngo == urlParameter).fetch(4)
			parameters["projects"] = q
			parameters["p_len"] = len(q)
			q = NGO.query(NGO.sectorOfOperation == parameters["ngo"].sectorOfOperation).fetch(4)
			p = [n for n in q if n.userid != parameters["ngo"].userid]
			parameters["similarNGOs"] = p
			print q
			parameters["n_len"] = len(p)
			self.render('ngoPage.html',parameters)
Beispiel #32
0
	def post(self):
		parameter = {}
		lat = self.request.get("lat")
		lng = self.request.get("lng")
		print lat, lng
		projects = Project.query().fetch()
		decorated = [(project,project.distance(lat,lng)) for project in projects if project.distance(lat,lng)<50]
		closeProjects = sorted(decorated, key=lambda tup: tup[1])
		parameter["closeProjects"] = closeProjects
		parameter["get"] = 0
		parameter["lat"] = lat
		parameter["lat"] = lng
		parameter["search"] = self.request.get("address")
		parameter["length"] = len(parameter["closeProjects"])
		self.render('explore.html',parameter)
        def post(self):
                category = self.request.get("category")
		title = self.request.get("title")
                user=users.get_current_user()
                userid = user.user_id()
                projectObject = Project()
                projectObject.ngo = userid
                projectObject.category = category
		projectObject.title = title 
		projectObject.authenticity = False
                projectObject.put()
		self.response.headers.add_header("Set-Cookie",str("title=%s"%title))
                sleep(5)
                self.redirect("/propose/project")
 def get(self, urlParameter):
     print urlParameter
     ngo, title = urlParameter.split("_")
     q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2",
                 title, ngo).fetch(1)
     funds = 0
     print q
     if q:
         parameters = {}
         for p in q:
             parameters["project"] = p
             ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
             parameters["ngo"] = ngoP[0]
         for task in parameters["project"].tasks:
             funds = funds + int(task[2])
         i = 0
         parameters["collected"] = 0
         parameters["funding"] = []
         while i < len(parameters["project"].funding):
             user = User.query(User.userid ==
                               parameters["project"].funding[i][0]).fetch(1)
             parameters["collected"] = parameters["collected"] + int(
                 parameters["project"].funding[i][1])
             parameters["funding"].append(
                 (user[0], parameters["project"].funding[i][1]))
             i = i + 1
         parameters["funding"].reverse()
         print parameters["project"].funding
         parameters["support"] = i
         print parameters["support"]
         projects = Project.query(
             Project.category == parameters["project"].category).fetch()
         closeProjects = []
         try:
             for i in range(0, 4):
                 randomInt = randint(0, len(projects) - 1)
                 if (projects[randomInt] not in closeProjects
                         and projects[randomInt] != parameters["project"]):
                     closeProjects.append(projects[randomInt])
         except:
             pass
         parameters["closeProjects"] = closeProjects
         parameters["funds"] = funds
         self.render("projectPage.html", parameters)
Beispiel #35
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter={}
				ngo = userAuthentication[0]
				projectsIdentifierList = ngo.projects
				projects = []
				for projectIdentifier in projectsIdentifierList:
					ngo, title = self.stripProjectIdentifier(projectIdentifier)
					projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
					projects.append(projectObject)
				parameter["projects"] = projects
				self.render("updateProject.html", parameter)
			else:
				self.redirect("/")	
		else:
			self.redirect("/login")
Beispiel #36
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter={}
				ngo = userAuthentication[0]
				projectsIdentifierList = ngo.projects
				projects = []
				for projectIdentifier in projectsIdentifierList:
					ngo, title = self.stripProjectIdentifier(projectIdentifier)
					projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
					projects.append(projectObject)
				parameter["projects"] = projects
				self.render("updateProject.html", parameter)
			else:
				self.redirect("/")	
		else:
			self.redirect("/login")
Beispiel #37
0
    def get(self,urlParameter):
		print urlParameter
		ngo, title = urlParameter.split("_")
		q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
		funds = 0
		print q
		if q:
			parameters = {}
			for p in q:
				parameters["project"] = p
				ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
				parameters["ngo"] = ngoP[0]
			for task in parameters["project"].tasks:
				funds = funds + int(task[2]);
			i=0
			parameters["collected"] = 0
			parameters["funding"] = []
			while i < len(parameters["project"].funding):
				user = User.query(User.userid == parameters["project"].funding[i][0]).fetch(1)
				parameters["collected"] = parameters["collected"] + int(parameters["project"].funding[i][1])
				parameters["funding"].append((user[0], parameters["project"].funding[i][1]))
				i=i+1
			parameters["funding"].reverse()
			print parameters["project"].funding
			parameters["support"]=i
			print parameters["support"]
			projects = Project.query(Project.category == parameters["project"].category).fetch()
			closeProjects = []
			try:
				for i in range(0,4):
					randomInt = randint(0,len(projects)-1)
					if(projects[randomInt] not in closeProjects and projects[randomInt] != parameters["project"]):
						closeProjects.append(projects[randomInt])
			except:
				pass
			parameters["closeProjects"] = closeProjects
			parameters["funds"] = funds
			self.render("projectPage.html", parameters)
Beispiel #38
0
    def post(self, urlParameter):
        ngoUserid, title = urlParameter.split("_")
        descriptionAuthenticity = self.request.get("descriptionAuthenticity")
        projectQuery = Project.query(Project.ngo == ngoUserid,
                                     Project.title == title)
        ngoQuery = NGO.query(NGO.userid == ngoUserid)
        ngo = ngoQuery.fetch(1)[0]
        project = projectQuery.fetch(1)[0]
        parameter = {}
        if descriptionAuthenticity == "on":
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your Project  has passed authentication test",
                body="""Dear :""" + ngo.name + "Your Project titled '" +
                project.title +
                "' has passed authentication and goes live!\n" +
                """Please let us know if you have any questions.The csr.com Team"""
            )
            project.authenticity = True
            project.put()
            parameter["message"] = "Success Mail Sent!"
            self.render("responseAdmin.html", parameter)

        else:
            failiureReport = "\nPlaces where your project failed\n"
            failiureReport += " The Description you provided isnt apt for a site like us.\n"
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your Project has failed authentication test",
                body="""Dear :""" + ngo.name + failiureReport +
                """Please let us know if you have any questions. \nThe csr.com Team"""
            )

            parameter["message"] = "Failure Report Sent!"
            self.render("responseAdmin.html", parameter)
Beispiel #39
0
def main(args):
    """
    Parameters
    ----------
    args: Array of arguments
        - arg[0] the user id
        - arg[1] the user choice of motif % kept
    Returns
    -------
    object: json object
        Contain the tree build from RNA sequence
    """

    print
    param = []
    #Load the rna sequences
    try:
        os.chdir(os.path.join("..", "python", "src"))
        print os.getcwd()
        path = os.path.join(os.getcwd(), "results_" + args[0] + ".json")
        json_data = open(path).read()
        param.append(json.loads(json_data))

    except:
        print "ERROR RECOVERING DATA"
        sys.exit(1)
    #user id
    param.append(args[0])
    #Motif %
    param.append(args[1])

    project = Project(param[0], param[1])
    project.runSNM()
    project.buildTree(score="variance", percentage=param[2])
    # Send it to stdout (to PHP)

    print json.dumps(project.tree.tree_format('json'))
Beispiel #40
0
 def post(self):
         count=int(self.request.get("count")) + 1
         category = self.request.get("category")
         address = self.request.get("address")
         lat = self.request.get("lat")
         lng = self.request.get("lng")
         title = self.request.get("title")
         link = title.replace(" ", "-")
         shortDescription = self.request.get("shortDescription")
         #date = time.strtftime("%Y-%m-%d %H:%M:%S")
         date =  datetime.date.today()
         date = str(date)
         funding = []
         print shortDescription
         user=users.get_current_user()
         userid = user.user_id()
         projectObject = Project()
         projectObject.ngo = userid
         projectObject.link = link
         projectObject.description = shortDescription
         projectObject.category = category
         projectObject.title = title 
         projectObject.funding = funding 
         projectObject.date = date 
         projectObject.address = address 
         projectObject.lat = lat 
         projectObject.lng = lng 
         projectObject.authenticity = False
         projectObject.tasks = [] 
         j=0
         while j<count:
             Counter=str(j)
             taskTitle = self.request.get("taskTitle"+Counter)
             taskDescription = self.request.get("taskDescription"+Counter)
             taskFund = self.request.get("taskFund"+Counter)
             j=j+1
             projectObject.tasks.append([taskTitle, taskDescription, taskFund])
         projectObject.put()
         self.response.headers.add_header("Set-Cookie",str("title=%s"%title))
         sleep(5)
         self.redirect("/home")
 def get(self):
         parameter = {}
         projectQuery = Project.query(Project.authenticity == False)
         projectList = projectQuery.fetch(10)
         parameter["projectList"] = projectList
         self.render("adminAuthenticate.html", parameter)
 def get(self, userid):
         parameter = {}
         projectQuery = Project.query(Project.userid == userid)
         project = projectQuery.fetch(1)
         parameter["projectList"] = ngo
         self.render("adminCredibilityCheckNGOPage.html", parameter)
import sys

from lib import Project
from lib import Options

if __name__ == '__main__':
    options = Options()
    opts = options.parse(sys.argv[1:])

    v = Project(opts)

    v.date()
    v.print_example_arg()
Status API Training Shop Blog About Pricing
Beispiel #44
0
 def get(self):
     parameter = {}
     projectQuery = Project.query(Project.authenticity == False)
     projectList = projectQuery.fetch(10)
     parameter["projectList"] = projectList
     self.render("adminAuthenticate.html", parameter)
Beispiel #45
0
import sys

from lib import Project
from lib import Options

if __name__ == '__main__':
    options = Options()
    opts, args = options.parse(sys.argv[1:])

    v = Project(opts)

    v.date()
 def post(self):
         count=int(self.request.get("count")) + 1
         category = self.request.get("category")
         address = self.request.get("address")
         lat = self.request.get("lat")
         lng = self.request.get("lng")
         title = self.request.get("title")
         search = self.request.get("title").lower()
         link = title.replace(" ", "-")
         shortDescription = self.request.get("shortDescription")
         #date = time.strtftime("%Y-%m-%d %H:%M:%S")
         date =  datetime.date.today()
         date = str(date)
         funding = []
         print shortDescription
         user=users.get_current_user()
         userid = user.user_id()
         projectObject = Project()
         projectObject.ngo = userid
         projectObject.link = link
         projectObject.description = shortDescription
         projectObject.category = category
         projectObject.title = title 
         projectObject.search = search 
         projectObject.funding = funding 
         projectObject.date = date 
         projectObject.address = address 
         projectObject.lat = lat 
         projectObject.lng = lng 
         projectObject.authenticity = False
         projectObject.tasks = [] 
         j=0
         while j<count:
             Counter=str(j)
             taskTitle = self.request.get("taskTitle"+Counter)
             taskDescription = self.request.get("taskDescription"+Counter)
             taskFund = self.request.get("taskFund"+Counter)
             j=j+1
             projectObject.tasks.append([taskTitle, taskDescription, taskFund])
         projectObject.put()
         self.response.headers.add_header("Set-Cookie",str("title=%s"%title))
         sleep(5)
         self.redirect("/home")
    def setUp(self):
        self.machine = Project(self._default_options())

        self.mock_process = MockProcess()
        self.machine.process = self.mock_process
Beispiel #48
0
def run(args):
    opts = Options()
    opts.parse(args[1:])

    w = Project(opts)
    print w.welcome()
  def setUp(self):
    self.machine = Project(self._default_options())

    self.mock_process = MockProcess()
    self.machine.process = self.mock_process
Beispiel #50
0
import sys

from lib import Project
from lib import Options

if __name__ == '__main__':
    options = Options()
    opts = options.parse(sys.argv[1:])

    v = Project(opts)

    v.date()
    v.print_example_arg()
 def get(self, userid):
     parameter = {}
     projectQuery = Project.query(Project.userid == userid)
     project = projectQuery.fetch(1)
     parameter["projectList"] = ngo
     self.render("adminCredibilityCheckNGOPage.html", parameter)