cc-d/ieddit

Blueprint function names same as ieddit.py names

Closed this issue · 6 comments

stets commented

Working on trying to get this to run in Docker...I think there will be issues with the mod.py file having functions that are named the same as in ieddit.py

Here's an excerpt of the error I hit

ieddit_1  |     return ctx.invoke(self.callback, **ctx.params)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
ieddit_1  |     return callback(*args, **kwargs)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
ieddit_1  |     return ctx.invoke(f, obj, *args, **kwargs)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
ieddit_1  |     return callback(*args, **kwargs)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 848, in run_command
ieddit_1  |     app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 305, in __init__
ieddit_1  |     self._load_unlocked()
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 330, in _load_unlocked
ieddit_1  |     self._app = rv = self.loader()
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 388, in load_app
ieddit_1  |     app = locate_app(self, import_name, name)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 240, in locate_app
ieddit_1  |     __import__(module_name)
ieddit_1  |   File "/ieddit/app.py", line 1316, in <module>
ieddit_1  |     from mod import bp
ieddit_1  |   File "/ieddit/mod.py", line 1, in <module>
ieddit_1  |     from app import *
ieddit_1  |   File "/ieddit/app.py", line 114, in <module>
ieddit_1  |     def suggest_title(url=None):
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1314, in decorator
ieddit_1  |     self.add_url_rule(rule, endpoint, f, **options)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 98, in wrapper_func
ieddit_1  |     return f(self, *args, **kwargs)
ieddit_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1283, in add_url_rule
ieddit_1  |     "existing endpoint function: %s" % endpoint
ieddit_1  | AssertionError: View function mapping is overwriting an existing endpoint function: suggest_title
cc-d commented

Yeah that's exactly it.

Should only take a few minutes to fix, hold on.

cc-d commented

So it's kind of strange suggest_title is what appears in the error.

There is name overlap in ieddity.py settings() and I think a few others.

Would appending mod_X and user_X to the function name correct this issue? Why would suggest_title() be the function which causes this issue?

There are also duplicated imports in suggest_title, urllib.parse. Would this have anything to do with it?

I'm terribly sorry for all of these issues, btw. Next time I build something like this I'll attempt to ensure I try to run it on more than just clean linux vps's, I just didn't think it would receive the amount of interest it did so quickly.

cc-d commented

f908881

The function names are now unique per blueprint, hopefully this is what you needed?

cc-d commented

Awesome. I'll take it that everything worked. I'll close this issue now.

stets commented

still running into that suggest-title one...will look into it later tonight when I get some time

cc-d commented

I'm going to close this as it should be covered by #71