Example #1
0
 def updateAction(form):
     data, errors = form.extract()
     if errors:
         form.message(errors, 'form-error')
         return
     form.context.name = data['name']
     form.message('Category has been updated.')
Example #2
0
 def updateAction(form):
     data, errors = form.extract()
     if errors:
         form.message(errors, 'form-error')
         return
     form.context.title = data['title']
     form.context.href = data['href']
     form.context.color = data['color']
     form.message('Link has been updated.')
Example #3
0
    def updateAction(form):
        data, errors = form.extract()
        if errors:
            form.message(errors, 'form-error')
            return

        category = models.Category(name = data['name'])
        ptah.get_session().add(category)

        form.message('Category has been created.')
        return HTTPFound(location='/')
    def update_action(form):
        data, errors = form.extract()

        if errors:
            form.message(errors, 'form-error')
            return

        pprint(data)

        form.message('Content has been updated.', 'info')
        return HTTPFound(location='.')
Example #5
0
 def updateAction(form):
     data, errors = form.extract()
     if errors:
         form.message(errors, 'form-error')
         return
     form.context.name = data['name']
     form.context.title = data['title']
     form.context.tagline = data['tagline']
     form.context.discussion = data['discussion']
     form.context.disqus = data['disqus']
     form.message('Blog has been updated.')
Example #6
0
    def updateAction(form):
        data, errors = form.extract()
        if errors:
            form.message(errors, 'form-error')
            return

        obj = models.RackObject(title=data['title'],
                                label=data['label'],
                                objtype=data['objtype'])
        ptah.get_session().add(obj)

        form.message('RackObject has been created.')
        return HTTPFound(location='/')
Example #7
0
    def updateAction(form):
        data, errors = form.extract()

        if errors:
            form.message(errors, 'form-error')
            return

        pprint(data)
        
        form.context.title = data['title']
        form.context.description = data['description']
        form.message('Content has been updated.', 'info')
        raise HTTPFound(location='.')
Example #8
0
    def updateAction(form):
        data, errors = form.extract()

        if errors:
            form.message(errors, 'form-error')
            return

        pprint(data)

        form.context.title = data['title']
        form.context.description = data['description']
        form.message('Content has been updated.', 'info')
        raise HTTPFound(location='.')
Example #9
0
    def updateAction(form):
        data, errors = form.extract()
        if errors:
            form.message(errors, 'form-error')
            return

        link = models.Link(title = data['title'],
                           href = data['href'],
                           color = data['color'])
        ptah.get_session().add(link)

        form.message('Link has been created.')
        return HTTPFound(location='/')
Example #10
0
 def updateAction(form):
     data, errors = form.extract()
     if errors:
         form.message(errors, 'form-error')
         return
     user = ptah.auth_service.get_current_principal().name
     form.context.creator = user
     form.context.title = data['title']
     form.context.tags = data['tags']
     form.context.category = data['category']
     form.context.text = data['text']
     form.context.discussion = data['discussion']
     form.context.modified = datetime.utcnow()
     form.message('Post has been updated.')
Example #11
0
    def updateAction(form):
        data, errors = form.extract()

        if errors:
            form.message(errors, 'form-error')
            return

        # form.context is ...
        form.context.fullname = data['fullname']
        form.context.phone = data['phone']
        form.context.email = data['email']
        form.context.subject = data['subject']

        # You would add any logic/database updates/insert here.
        # You would probably also redirect.

        log.info('The form was updated successfully')
        form.message('The form was updated successfully')
Example #12
0
    def updateAction(form):
        data, errors = form.extract()
        if errors:
            form.message(errors, 'form-error')
            return

        now = datetime.utcnow()
        user = ptah.auth_service.get_current_principal().name
        post = models.Post(creator = user,
                           title = data['title'],
                           tags = data['tags'],
                           category = data['category'],
                           text = data['text'],
                           discussion = data['discussion'],
                           modified = now,
                           created = now)
        ptah.get_session().add(post)

        form.message('Post has been created.')
        return HTTPFound(location='/')
Example #13
0
    def loginAction(form):
        request = form.request
        data, errors = form.extract()
        if errors:
            form.message(errors, "form-error")
            return

        info = ptah.auth_service.authenticate(data)
        if info.status:
            headers = security.remember(request, info.principal.uri)
            return HTTPFound(headers=headers, location=request.application_url)

        if info.message:
            form.message(info.message, "warning")
            return

        form.message("You enter wrong login or password.", "error")
Example #14
0
    def loginAction(form):
        request = form.request
        data, errors = form.extract()
        if errors:
            form.message(errors, 'form-error')
            return

        info = ptah.auth_service.authenticate(data)
        if info.status:
            headers = security.remember(request, info.principal.uri)
            return HTTPFound(headers = headers,
                             location = request.application_url)

        if info.message:
            form.message(info.message, 'warning')
            return

        form.message('You enter wrong login or password.', 'error')
Example #15
0
 def cancel_action(form):
     form.message('Cancel button', 'info')
 def cancel_handler(self):
     form.message('Cancel button', 'info')
     raise HTTPFound(location='/test-form.html')
Example #17
0
 def cancel_handler(self):
     form.message('Cancel button', 'info')
     raise HTTPFound(location='/test-form.html')