-
Notifications
You must be signed in to change notification settings - Fork 272
Support for flairs #28
Comments
Fount this in PRAW's code overview. May be helpful:
|
I`m going to take a look at doing this. |
Hey @michael-lazar, I've been looking at doing this but I'm having trouble finding where the comments and submission text are actually set / drawn to the screen. In the submissions.py module there are functions such as draw_submission and draw_comment. In these there are variables called text which seem to then be put into the curses screen. I've tried adding extra text to these text variables just to see what that would affect and it actually did nothing. Am I misunderstanding what this section of the code does? |
That sounds like you're doing it correctly. Keep in mind that subreddit.py controls the main page, and submission.py controls the comments page. If you're trying to change the behavior of the main page, you need to look at subreddit.draw_item(). That being said, changing the text to something like text = '{author} test_flair'.format(**data) should produce a visible output. If it still doesn't, my guess is that python is grabbing files from a different location than you are expecting. If so let me know and we can walk through setting everything up. |
Yeah I think Python must be grabbing files from a different place. Should I perhaps uninstall the system wide rtv that I installed via package manager? Or what would you suggest doing?
|
Here's what I've been doing lately. First make sure that your repo is up-to-date.
Explanation: from rtv.main import main
main() inside of |
Using python -m totally fixed my problem. I was running using python rtv/main.py before and for whatever reason it doesn't import from the correct place when running it that way. Thanks for giving me a hand on this, I'm going to continue working away on adding this feature. |
I'm having an issue where as soon as I add a get_flair() call to content.py the program starts immediately crashing with the error message "Could not reach /r/front". My initial thought was that an exception was being thrown and getting caught by a block that does that but I haven't been able to figure out what's happening. get_flair documentation doesn't indicate that it would be throwing any exceptions and should just be returning None if the user or subreddit was not found. Do you have any idea why adding get_flair calls into the split_submission method in content.py would be causing it to crash with this message? (Note that even when get_flair is called for ANY subreddit, it always says "Could not reach /r/front") Here is the rough block of code that I wrote for getting started with testing this out. (Note that the if condition for checking for "/r/front" is just because I had no idea what was causing the crash with that message and wanted to make sure it wasn't trying to use /r/front as an actual subreddit.)
The exception that it seems to be hitting is the one in main that catches SubredditNameErrors |
You're correct that the exception is getting caught where it shouldn't be. content.py, line 361 content = cls(display_name, submissions, loader)
try:
content.get(0)
except:
# TODO: Trap specific errors
raise SubredditNameError(display_name) Try getting rid of this try-except block content = cls(display_name, submissions, loader)
content.get(0) and your error should propagate through. |
Would be nice if we could support flairs from different subreddits. Would look something like
The text was updated successfully, but these errors were encountered: