Commit Graph

4 Commits

Author SHA1 Message Date
Kfir Hadas 87dd95f1e0 Refactor into an app factory [2 of 2] (#322)
* Replace all `from nyaa import app` imports with `app = flask.current_app` (or `from flask import current_app as app` where possible)
* Add a separate config object for top-level and class statements as `nyaa.extensions.config`
Required because those codes don't have app context at the time of evaluation/execution.
* Remove `routes.py` file and register all blueprints in `nyaa/__init__.py`
* Refactor `nyaa/__init__.py` into an app factory
* Update tools
* Update tests (temporary, will be replaced)
2017-08-01 21:02:08 +03:00
Kfir Hadas 0181d6cb33 Prepare for app factory [1 of 2] (#315)
* Move db, assets, debug toolbar and fix_paginate into nyaa.extensions
* Change all `from nyaa import db` imports to `from nyaa.extensions import db`
* Move `nyaa.torrents.create_magnet_from_es_info` context processor into template-utils blueprint
* Fix tools (wrap in `with app.app_context():` where needed)
2017-07-30 20:35:16 +03:00
Kfir Hadas 50529920bd Move /user/activate/<payload> route into users
Move supporting functions as well:
  - get_serializer
  - get_activation_link
2017-07-27 14:14:00 +03:00
Kfir Hadas 0887dde6fc Move /user/<user_name> route into a blueprint
Move supporting functions and variables into other files
* nyaa.utils:
  - cached_function
  - chain_get
* nyaa.search:
  - DEFAULT_MAX_SEARCH_RESULT
  - DEFAULT_PER_PAGE
  - SERACH_PAGINATE_DISPLAY_MSG
  - _generate_query_string
2017-07-27 14:14:00 +03:00