Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9133605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:31:01+00:00 2026-06-17T08:31:01+00:00

I’m working on a website that has a Sign up page which should be

  • 0

I’m working on a website that has a “Sign up” page which should be callable from anywhere in the site.

I have the following dummy interface and implementation for the “user” product:

Interface:

 ##
 ## located in bahmanm/sampleapp/interfaces.py
 ##
 class ISampleAppUser(Interface):
        """
        """

Implementation:

 ##
 ## located in bahmanm/sampleapp/implementation/SampleAppUser.py
 ##
 class SampleAppUser:
      """
      """

      implements(ISampleAppUser)

 # Note that this method is outside of the implementation class.
 #
 def manage_addSampleAppUser(self, id, title):
    # ...

Now, for the moment, let’s assume there’s a link on the index page which leads to the following template (Sign up template):

 <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns="http://xml.zope.org/namespaces/tal">
   <head><title>Add a new User</title></head>
   <body>
    <h2>Add a user instance</h2>
    <form action="#" method="POST"
          tal:attributes="action python:'manage_addSampleAppUser'">
       <p>Id: <input type="text" name="id"/></p>
       <p>Title: <input type="text" name="title"/></p>
       <input type="submit" value="Add"/>
    </form>
   </body>
  </html>

However I haven’t been able to find the right value for action property of the form; all I get is a “resource not found”.

Honestly, I believe it’s a problem of understanding Zope’s mechanisms on my side. I’d really appreciate any hints/clues on where should I go digging for the solution, configure.zcml or the implementation or the template itself. TIA,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:31:02+00:00Added an answer on June 17, 2026 at 8:31 am

    You really want to create a view for that; you can call a Product factory like that from a URL too, but it is not recommended.

    With a view, you can combine the form and the code to create the new user in one place:

    from zope.publisher.browser import BrowserPage
    from sampleapp.implementation.SampleAppUser import manage_addSampleAppUser
    
    
    class NewUserSignup(BrowserPage):
        def __call__(self):
            # called when the view is being rendered
            if 'submit' in self.request:
                # form was submitted, handle
                self.addUser()
            return self.index()  # render the template
    
        def addUser(self):
            # extract form fields from self.request.form
            # validation, error handling, etc.
            if someerror:
                self.error = 'Error message!'
                return
    
            user = manage_addSampleAppUser(self.context, id, title)
            # add things to this new user if needed
    
            # all done, redirect to the default view on the new user object
            self.request.response.redirect(user.absolute_url())
    

    then register this view with something like:

    <browser:page
        for="*"
        name="signup"
        class=".signup.NewUserSignup"
        template="signup.pt"
        permission="zope.public"
        />
    

    When your new page is registered, the named template is added as a index attribute on your NewUserSignup class, so the __call__ method can invoke it (self.index()) and return the results.

    Because you combined the signup handling and the template together, you can now easily incorporate error handling. When someone loads the page for the first time self.request.form will be empty, but as soon as someone hits the submit button, you can detect this and call the addUser method.

    That method can either create the user and then redirect away from this page, or set an error message and return, at which point the form is re-rendered.

    This makes the action easy to set; you could just leave it empty, or you can set it to the current context URL plus the name of the view. Together, the template then becomes:

    <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns="http://xml.zope.org/namespaces/tal">
       <head><title>Add a new User</title></head>
       <body>
        <h2>Add a user instance</h2>
        <div class="errormessage" tal:condition="view/error|nothing" tal:content="view/error">
            Conditional error message appears here
        </div>
    
        <form action="#" method="POST"
              tal:attributes="action string:${context/absolute_url}/@@${view/__name__}">
           <p>Id: <input type="text" name="id"
                          tal:attributes="value request/form/id|nothing" /></p>
           <p>Title: <input type="text" name="title"
                          tal:attributes="value request/form/title|nothing" /></p>
           <input type="submit" value="Add" name="submit"/>
        </form>
       </body>
    </html>
    

    Note how the form inputs are pre-filled with existing data from the request as well, making it easier for your visitor to correct any errors they may have made.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.