Пример #1
0
 def doadd(self):
     soft = Software()
     soft.name = self.form_result.get('software_name')
     soft.download_url =  self.form_result.get('download_url')
     Session.add(soft)
     Session.commit()        
     redirect(url(controller="mobile", action="index"))
Пример #2
0
 def doadd(self):
     soft = Software()
     soft.name = self.form_result.get('software_name')
     soft.download_url = self.form_result.get('download_url')
     Session.add(soft)
     Session.commit()
     redirect(url(controller="mobile", action="index"))
Пример #3
0
    def saveSoftware(self, soft):
        Session.query(Software).filter(Software.id == soft.id).update({
            Software.name:
            soft.name,
            Software.download_url:
            soft.download_url
        })

        Session.commit()
Пример #4
0
    def doedit(self):
        soft_id = request.params.getone('software_id')
        soft = Session.query(Software).filter(Software.id == soft_id).first()
        #soft = Software() #Session.merge(old_soft)
        #soft.id = self.form_result.get('software_id')
        soft.name = self.form_result.get('software_name')
        soft.download_url = self.form_result.get('download_url')

        Session.commit()
        #redirect(url(controller="mobile", action="index"))

        redirect(url(controller="mobile", action="index"))
Пример #5
0
 def doedit(self):             
     soft_id = request.params.getone('software_id')  
     soft = Session.query(Software).filter(Software.id == soft_id).first()        
     #soft = Software() #Session.merge(old_soft)
     #soft.id = self.form_result.get('software_id')  
     soft.name = self.form_result.get('software_name')
     soft.download_url =  self.form_result.get('download_url')      
     
     Session.commit()        
     #redirect(url(controller="mobile", action="index"))  
     
     redirect(url(controller="mobile", action="index"))  
Пример #6
0
 def edit(self, id=0):
     soft_id = id
     if soft_id == 0:
         #soft_id = self.form_result.get('software_id')
         redirect(url(controller="mobile", action="index"))        
     soft = Session.query(Software).filter(Software.id == soft_id).first()
     if not soft is None:            
         c.soft = soft
         return render('/mobile/edit.html')        
Пример #7
0
 def edit(self, id=0):
     soft_id = id
     if soft_id == 0:
         #soft_id = self.form_result.get('software_id')
         redirect(url(controller="mobile", action="index"))
     soft = Session.query(Software).filter(Software.id == soft_id).first()
     if not soft is None:
         c.soft = soft
         return render('/mobile/edit.html')
Пример #8
0
 def doeditX(self, id=0):
     schema = NewSoftwareForm()
     try:
         c.form_result = schema.to_python(dict(request.params))
     except formencode.Invalid, error:
         c.form_result = error.value
         c.form_errors = error.error_dict or {}
         soft_id = id
         if soft_id == 0:
             redirect(url(controller="mobile", action="index"))
         soft = Session.query(Software).filter(
             Software.id == soft_id).first()
         #if not soft is None:
         c.soft = soft
         html = render('/mobile/edit.html')
         return htmlfill.render(html,
                                defaults=c.form_result,
                                errors=c.form_errors
                                #auto_error_formatter=self.custom_formatter
                                )
Пример #9
0
 def doeditX(self, id=0):
     schema = NewSoftwareForm()
     try:
         c.form_result = schema.to_python(dict(request.params))
     except formencode.Invalid, error:
         c.form_result = error.value
         c.form_errors = error.error_dict or {}
         soft_id = id
         if soft_id == 0:
             redirect(url(controller="mobile", action="index"))        
         soft = Session.query(Software).filter(Software.id == soft_id).first()
         #if not soft is None:            
         c.soft = soft
         html = render('/mobile/edit.html')
         return htmlfill.render(
             html,
             defaults=c.form_result,
             errors=c.form_errors
             #auto_error_formatter=self.custom_formatter
         )
Пример #10
0
 def get_reviews(self):
     rs = session.query(SoftwareReview).filter(
         SoftwareReview.software_id == self.id)
     return rs
Пример #11
0
 def get_versions(self):
     vs = session.query(SoftwareVersion).filter(
         SoftwareVersion.software_id == self.id)
     return vs
Пример #12
0
            soft = Session.query(Software).filter(Software.id == soft_id).first()
            #if not soft is None:            
            c.soft = soft
            html = render('/mobile/edit.html')
            return htmlfill.render(
                html,
                defaults=c.form_result,
                errors=c.form_errors
                #auto_error_formatter=self.custom_formatter
            )
        else:              
            soft = Software()
            soft.id = c.form_result.get('software_id')
            soft.name = c.form_result.get('software_name')
            soft.download_url =  c.form_result.get('download_url')
            Session.update(soft)
            Session.commit()        
            redirect(url(controller="mobile", action="index"))     
        

    
#    def newnode(self, id):
#      c.parent_id = id
#      return render('newnode.html')
#    
#    @validate(schema=NewSoftwareForm(), form='add')
#    def createnode(self):
#      soft_name = self.form_result.get('software_name')
#      soft_url = self.form_result.get('download_url')
#      soft_id = save_the_data(parentId, childName)
#      return redirect_to(controller = 'mobile', action = 'index', id = soft_id)
Пример #13
0
 def index(self):
     softq = Session.query(Software).limit(100)
     c.softs = softq       
     return render('/mobile/index.html')
Пример #14
0
 def get_versions(self):
     vs = session.query(SoftwareVersion).filter(SoftwareVersion.software_id == self.id)
     return vs
Пример #15
0
 def get_reviews(self):
     rs = session.query(SoftwareReview).filter(SoftwareReview.software_id == self.id)
     return rs        
Пример #16
0
 def get_followers(self, limit=20):
     fs = session.query(SoftwareFollower).filter(SoftwareFollower.software_id == self.id)
     return fs
Пример #17
0
 def get_followers(self, limit=20):
     fs = session.query(SoftwareFollower).filter(
         SoftwareFollower.software_id == self.id)
     return fs
Пример #18
0
 def saveSoftware(self, soft):
     Session.query(Software).filter(Software.id == soft.id).update({Software.name: soft.name, Software.download_url: soft.download_url})
         
     Session.commit()
Пример #19
0
            soft = Session.query(Software).filter(
                Software.id == soft_id).first()
            #if not soft is None:
            c.soft = soft
            html = render('/mobile/edit.html')
            return htmlfill.render(html,
                                   defaults=c.form_result,
                                   errors=c.form_errors
                                   #auto_error_formatter=self.custom_formatter
                                   )
        else:
            soft = Software()
            soft.id = c.form_result.get('software_id')
            soft.name = c.form_result.get('software_name')
            soft.download_url = c.form_result.get('download_url')
            Session.update(soft)
            Session.commit()
            redirect(url(controller="mobile", action="index"))


#    def newnode(self, id):
#      c.parent_id = id
#      return render('newnode.html')
#
#    @validate(schema=NewSoftwareForm(), form='add')
#    def createnode(self):
#      soft_name = self.form_result.get('software_name')
#      soft_url = self.form_result.get('download_url')
#      soft_id = save_the_data(parentId, childName)
#      return redirect_to(controller = 'mobile', action = 'index', id = soft_id)
Пример #20
0
 def index(self):
     softq = Session.query(Software).limit(100)
     c.softs = softq
     return render('/mobile/index.html')
Пример #21
0
 def get_android_apps(self):
     return session.query(Software).filter(Software.type == '1')
Пример #22
0
 def get_android_apps(self):
     return session.query(Software).filter(Software.type == '1')