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 9162507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:13:38+00:00 2026-06-17T14:13:38+00:00

I’ve tried to build the simplest possible form in Sprox using pyramid. # model.py

  • 0

I’ve tried to build the simplest possible form in Sprox using pyramid.

# model.py
class Allocation:
    # some fields ...
class SproxForm(AddRecordForm):
    __model__ = Allocation

sprox_form = SproxForm(DBSession)

# views.py
@view_config(route_name='sprox_add', renderer='templates/sprox.pt')
def sprox_form_add(request):
    return {'form':sprox_form,'form_input':{}}

<!-- sprox.pt -->
<html>
<body>
<div tal:content="structure form(form_input)"/>
</body>
</html>

When I navigate to that view in the browser, I get

Traceback (most recent call last):
  File "D:\prg\py2\lib\site-packages\pyramid_debugtoolbar-1.0.4-py2.7.egg\pyramid_debugtoolbar\panels\performance.py", line 69, in noresource_timer_handler
    result = handler(request)
  File "D:\prg\py2\lib\site-packages\pyramid\tweens.py", line 21, in excview_tween
    response = handler(request)
  File "D:\prg\py2\lib\site-packages\pyramid_tm-0.7-py2.7.egg\pyramid_tm\__init__.py", line 82, in tm_tween
    reraise(*exc_info)
  File "D:\prg\py2\lib\site-packages\pyramid_tm-0.7-py2.7.egg\pyramid_tm\__init__.py", line 63, in tm_tween
    response = handler(request)
  File "D:\prg\py2\lib\site-packages\pyramid\router.py", line 161, in handle_request
    response = view_callable(context, request)
  File "D:\prg\py2\lib\site-packages\pyramid\config\views.py", line 367, in rendered_view
    context)
  File "D:\prg\py2\lib\site-packages\pyramid\renderers.py", line 531, in render_view
    return self.render_to_response(response, system, request=request)
  File "D:\prg\py2\lib\site-packages\pyramid\renderers.py", line 561, in render_to_response
    result = self.render(value, system_values, request=request)
  File "D:\prg\py2\lib\site-packages\pyramid\renderers.py", line 557, in render
    result = renderer(value, system_values)
  File "D:\prg\py2\lib\site-packages\pyramid\chameleon_zpt.py", line 42, in __call__
    result = self.template(**system)
  File "D:\prg\py2\lib\site-packages\chameleon\template.py", line 125, in __call__
    return self.render(**kwargs)
  File "D:\prg\py2\lib\site-packages\chameleon\zpt\template.py", line 257, in render
    return super(PageTemplate, self).render(**vars)
  File "D:\prg\py2\lib\site-packages\chameleon\template.py", line 190, in render
    raise_with_traceback(exc, tb)
  File "D:\prg\py2\lib\site-packages\chameleon\template.py", line 172, in render
    self._render(stream, econtext, rcontext)
  File "sprox_3aacd319285f07641f9292cdee192301f3a0bccd.py", line 136, in render

  File "D:\prg\py2\lib\site-packages\chameleon\zpt\template.py", line 261, in include
    self._render(*args, **kwargs)
  File "template_f352de36cd7e76f81188f12078004a91a152cf44.py", line 376, in render

  File "sprox_3aacd319285f07641f9292cdee192301f3a0bccd.py", line 106, in __fill_content

  File "D:\prg\py2\lib\site-packages\sprox\viewbase.py", line 113, in __call__
    return self.display(*args, **kw)
  File "D:\prg\py2\lib\site-packages\sprox\viewbase.py", line 119, in display
    return self.__widget__.display(*args, **kw)
  File "D:\prg\py2\lib\site-packages\tw2\core\widgets.py", line 438, in display
    return self.generate_output(displays_on)
  File "D:\prg\py2\lib\site-packages\tw2\core\widgets.py", line 475, in generate_output
    mw,
  File "D:\prg\py2\lib\site-packages\tw2\core\templating.py", line 204, in render
    return callback(kwargs)
  File "D:\prg\py2\lib\site-packages\tw2\core\templating.py", line 144, in <lambda>
    return lambda kwargs: Markup(tmpl.render(**kwargs))
  File "D:\prg\py2\lib\site-packages\mako\template.py", line 412, in render
    return runtime._render(self, self.callable_, args, data)
  File "D:\prg\py2\lib\site-packages\mako\runtime.py", line 766, in _render
    **_kwargs_for_callable(callable_, data))
  File "D:\prg\py2\lib\site-packages\mako\runtime.py", line 798, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "D:\prg\py2\lib\site-packages\mako\runtime.py", line 824, in _exec_template
    callable_(context, *args, **kwargs)
  File "form_mak", line 49, in render_body

  File "D:\prg\py2\lib\site-packages\tw2\core\widgets.py", line 436, in display
    r.prepare()
  File "D:\prg\py2\lib\site-packages\tw2\core\resources.py", line 165, in prepare
    resources = rl['middleware'].resources
KeyError: 'middleware'

 - Expression: "form(form_input)"
 - Filename:   d:\prg\py2\awsalloc2\awsalloc2\templates\sprox.pt
 - Location:   (9:28)
 - Source:     ... v tal:content="structure form(form_input)" />
                                            ^^^^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               renderer_name: templates/sprox.pt
               req: <Request - at 0x46fceb8L>
               form: <SproxForm - at 0x471cb38L>
               request: <Request - at 0x46fceb8L>
               renderer_info: <RendererHelper - at 0x4a3b7b8L>
               context: <instance None at 0x4f93c88L>
               form_input: {...} (0)
               view: <function sprox_form_add at 0x4a3d278L>
  • 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-17T14:13:40+00:00Added an answer on June 17, 2026 at 2:13 pm

    I have no idea what your real problem is, but I threw together a little demo to demonstrate how to setup Sprox under Pyramid. It was somewhat painful and uses some idioms that I consider pretty outdated, including requiring Paste, SQLAlchemy < 0.8, Genshi, and ToscaWidgets < 2.0. Hope this helps.

    If I had to guess, you aren’t adding the middleware to your app.

    app = tw.api.make_middleware(
        app,
        {
            'toscawidgets.framework' : 'wsgi',
            'toscawidgets.middleware.inject_resources' : True,
        },
        stack_registry=True,
    )
    

    https://github.com/mmerickel/pyramid_sprox_demo

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.