Hot answers tagged

14 votes
Accepted

Pset7 - :( quote handles valid ticker symbol

I found a solution here. I didn't format the price of stock by usd(). When I changed my code from {{ price }} to {{ price | usd }} in quoted.html, it worked.
3 votes

pset7 quote.php

i figure it out myself by looking at how apologize sends the message to apology form and in my case i have to use render like render("quote.php", ["stock" => $stock]);
1 vote
Accepted

Why does my lookup function keep returning "None"?

Since the quote spec calls for an element named "symbol", and this if not request.form.get("stock"): is apparently working, it looks like the element is not named properly in the ...
1 vote

C$50 Finance Buy and Quote not working

Your issue is that you aren't formatted your numbers such that you are probably displaying 28 instead of 28.00 You are given a this: # Custom filter app.jinja_env.filters["usd"] = usd that can be ...
  • 18.4k
1 vote
Accepted

PSET7 Finance- Quote and Buy not passing all checks

Your guess: is that it has something to do with a rounding error as it is looking for a specific number. is probably right. Usually using the 'usd' function in helpers.py will fix that right up....
1 vote
Accepted

Finance - Quote - 500 Internal Server Error

When looking at the log file, we can see that the last line says: File "/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/templating.py", line 86, in _get_source_fast raise ...
1 vote

pset7 Finance quote not returning anything?

Never mind. I feel like an idiot. I figured out what was wrong and have now fixed it. I was not calling the lookup function properly.
  • 21
1 vote
Accepted

Pset 7 - CS50 Finance: "Quote" keeps redirecting me to a register error

Check your quote.html, especially the URL the form submits to. I assume that's a Guttenbug (bug by copy&paste).
  • 20.7k
1 vote
Accepted

Helper in finance seems to be missing name

Unfortunately, the API we are now using doesn't return the name, so you do not have to display the name any longer.
  • 18.4k
1 vote
Accepted

pset7, html: {{ stock.name }} displays same value as {{ stock.symbol }}?

The API that is being called doesn't return the name, so for backwards compatibility (for those parts of the code that were written when the Yahoo Finance API was being used), the symbol is put into ...
  • 18.4k
1 vote
Accepted

else syntax error finance

You use a string literal """Get stock quote.""" as a comment. That one, as it's on the same indentation level as the if, breaks the if block, but it's not an else keyword, so when eventually finding ...
  • 20.7k
1 vote
Accepted

AssertionError rears its head all the time

In flask, @app.route is a decorator. From the flask View Decorators doc: To use the decorator, apply it as innermost decorator to a view function. When applying further decorators, always remember ...
1 vote
Accepted

Why do I get a wrong html file after executing a quote function? pset finance

Look at the tab when you are entering the stock symbol. Does it say "Register"? Looks like quote.html started with the register.html code. It's still calling the register route on submit.
1 vote
Accepted

Quote doesn't render quote_form

Actually what I did wrong is the php tag at the most top where I should write Thanks everyone.
1 vote
Accepted

CS50 - Pset7 - Quote Redirects To Login - 2017

session.clear() clears the session variables, which holds the user id, which makes @login_required think there is not a logged in user. (Notice the comment before session.clear() in the supplied login ...
1 vote
Accepted

CS50x2017 Pset7 quoted.html Extracting Dict Items in Template?

Jinja Documentation | Variables You can access the values the same way as in Python: {{ dictionary['key'] }} You can alternatively use dot notation: {{ dictionary.key }}
1 vote
Accepted

Pset 7 quote - help!

The error is telling you that the argument sent to lookup is None type. It expects a string type. Instead of looking "forward" to lookup, you need to look "backwards" to discover why request.form.get("...
1 vote
Accepted

Explain the syntax for function render in PSET 7

=> is the notation for a key-value pair in an associative array. Arrays that are indexed by key-value pairs like this (instead of indexed by integers, like arrays in C) are sometimes called "...
  • 3,036
1 vote

Pset7 Quote What does this error mean?

You can see from helpers.php the conditions under which that particular error will be triggered: if (file_exists("../views/{$view}")) { // extract variables into local scope, tc....
  • 1,415
1 vote
Accepted

pset7 quote - action

As a general rule, a browser cannot access files outside the document root. This is one of 132,000 articles that Mr. Google supplied when asked. php is not likewise constrained because it runs on the ...

Only top scored, non community-wiki answers of a minimum length are eligible