19
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.
2
votes
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).
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 ...
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.
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.
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 ...
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 ...
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 "...
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
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
Related Tags
quote × 35pset7 × 29
finance × 10
buy × 3
cs50x × 2
python × 2
html × 2
pset9 × 2
application.py × 2
quote.php × 2
display-results × 2
pset8 × 1
error × 1
check × 1
php × 1
cs50x2017 × 1
function × 1
sell × 1
help × 1
register × 1
lookup × 1
invalid × 1
nonetype × 1
dict × 1
render × 1