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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:19:26+00:00 2026-06-18T19:19:26+00:00

Here are three Pyramid view_callables which setup a page with data and two image

  • 0

Here are three Pyramid view_callables which setup a page with data and two image files. Trouble is, only one of the images (file responses) is returned. It seems I can only return one of the images at a time. If I take one of the file response vc’s away, the other images is returned. However, if I have both file respone vc’s there, only the second image is returned. Is there some object in the first vc I’m overwriting with the second vc?

Is there a better way to return both images (files), even within the first # title vc? As it is now, even if it worked, I have to retrieve the same document from the database 3 times for the one template. Any advice or clues would be greatly appreciated.

# title
@view_config(
        route_name='title',
        renderer='templates/titles/title.jinja2')
def title(request):
    title = Title().find_one({'_id':ObjectId(request.matchdict['_id'])})
    result = dict(
            user = request.user,
            title = title)
    return result

# view title image
@view_config(route_name="view_title_image")
def jpg(request):
    fd = Title().find_one({'_id':ObjectId(request.matchdict['title_id'])}).TitleImage
    response = Response(content_type='application/jpg')
    response.app_iter = fd.File
    print fd
    return response

# view trailer thumbnail
@view_config(route_name="view_trailer_thumbnail")
def jpg(request):
    fd = Title().find_one({'_id':ObjectId(request.matchdict['title_id'])}).TrailerThumbnail
    response = Response(content_type='application/jpg')
    response.app_iter = fd.File
    print fd
    return response

Here are the route configs from __init__:

# title
config.add_route('title', '/title/{_id}')

# view title image
config.add_route('view_title_image', '/view/title_image/{title_id}')

# view title image
config.add_route('view_trailer_thumbnail', '/view/trailer_thumbnail/{title_id}')

This is how its used in the Jinja2 template:

<img src="/view/title_image/{{ title._id }}">

<img src="/view/trailer_thumbnail/{{ title._id }}">
  • 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-18T19:19:28+00:00Added an answer on June 18, 2026 at 7:19 pm

    I think your problem is that both views have the function named jpg.

    Although it’s not a great idea to overwrite functions like that, I would have thought that this would be no problem at all for the view_config decorator. The only thing I can think of is that rather recording a reference to the function, view_config works out what the dotted path would be and records that.

    Anyway, give the view functions different names and you should be fine.

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

Sidebar

Related Questions

okey so here is my structure. one.php two.php three.php one.php includes both two.php and
I would expect the output of the following code to be: one two three
Okay, Here are three Facebook URLs: http://facebook.com/about [A Facebook Page] http://facebook.com/zuck [Zuckerberg's Profile] http://facebook.com/like
Here are three pieces of similar code, the first two run fine, the last
I am having three arraylist,Here I have to concatenate 2 arraylist and display it
This is a continuation of this question from yesterday . Here are my three
Here are the constraints I have three buckets (water) capacities 10 litre, 2 liters
Here's my scenario: I need to make three or four calls to different WCF
I have three tables: Employee(EmployeeID,Fname,Lname...) ProjectHeader(ProjectID,LeadID,Status....) ProjectDetails(ProjectDetailsID,ProjectID....) Here's my current code: $get_projects = SELECT
Here's a tricky iPhone problem I've been working on. I have three UIScrollViews on

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.