Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

EPIC:camelCase -->snake_case#199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
DogukanUrker wants to merge24 commits intomain
base:main
Choose a base branch
Loading
fromcamelCase-to-snake_case
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
24 commits
Select commitHold shift + click to select a range
13590de
EPIC: `camelCase` --> `snake_case`
DogukanUrkerJul 11, 2025
bcb7283
Refactor to use snake_case and update imports/routes
DogukanUrkerJul 11, 2025
cf8bce4
Update routes and templates, add detailed logging
DogukanUrkerJul 11, 2025
8674047
Refactor code formatting and remove unused imports
DogukanUrkerJul 11, 2025
894d209
Fix column name usage and update .gitignore for logs
DogukanUrkerJul 11, 2025
a2abd85
Delete app/log/log.json
DogukanUrkerJul 11, 2025
244668d
Add blank line after .idea in .gitignore
DogukanUrkerJul 12, 2025
dd5127a
Fix SQL query to use correct column name
DogukanUrkerJul 12, 2025
f4fe5b2
Refactor route and variable naming for consistency
DogukanUrkerJul 13, 2025
eb324db
Refactor user_name to username across codebase
DogukanUrkerJul 14, 2025
ae62373
Update users.db
DogukanUrkerJul 14, 2025
d5ce217
...
DogukanUrkerSep 2, 2025
89e4526
remove Analytics
DogukanUrkerSep 2, 2025
9c72db3
...
DogukanUrkerSep 2, 2025
8a2ce89
...
DogukanUrkerSep 2, 2025
f1075b4
ruff format
DogukanUrkerSep 2, 2025
36a71c7
Remove password reset and user verification templates
DogukanUrkerSep 2, 2025
5e44274
Delete analytics.db
DogukanUrkerSep 2, 2025
fd6be64
....
DogukanUrkerSep 2, 2025
c8b55c2
camelCase --> snake_case
DogukanUrkerSep 2, 2025
93329d2
camelCase --> snake_case
DogukanUrkerSep 2, 2025
65c1e1b
Update settings.py
DogukanUrkerSep 2, 2025
f5686ac
camelCase --> snake_case
DogukanUrkerSep 2, 2025
b657907
Update search.html
DogukanUrkerSep 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
EPIC:camelCase -->snake_case
  • Loading branch information
@DogukanUrker
DogukanUrker committedJul 24, 2025
commit13590deb0091b147fdb5ece1d0231cc9786affac
File renamed without changes.
174 changes: 86 additions & 88 deletionsapp/app.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,103 +10,101 @@
CSRFProtect,
)
from routes.about import (
aboutBlueprint,
about_blueprint,
)
from routes.accountSettings import (
accountSettingsBlueprint,
account_settings_blueprint,
)
from routes.adminPanel import (
adminPanelBlueprint,
admin_panel_blueprint,
)
from routes.adminPanelComments import (
adminPanelCommentsBlueprint,
admin_panel_comments_blueprint,
)
from routes.adminPanelPosts import (
adminPanelPostsBlueprint,
admin_panel_posts_blueprint,
)
from routes.adminPanelUsers import (
adminPanelUsersBlueprint,
admin_panel_users_blueprint,
)
from routes.category import (
categoryBlueprint,
category_blueprint,
)
from routes.changeLanguage import (
changeLanguageBlueprint,
change_language_blueprint,
)
from routes.changePassword import (
changePasswordBlueprint,
change_password_blueprint,
)
from routes.changeProfilePicture import (
changeProfilePictureBlueprint,
change_profile_picture_blueprint,
)
from routes.changeUserName import (
changeUserNameBlueprint,
change_user_name_blueprint,
)
from routes.createPost import (
createPostBlueprint,
create_post_blueprint,
)
from routes.dashboard import (
dashboardBlueprint,
dashboard_blueprint,
)
from routes.editPost import (
editPostBlueprint,
edit_post_blueprint,
)
from routes.index import (
indexBlueprint,
index_blueprint,
)
from routes.login import (
loginBlueprint,
login_blueprint,
)
from routes.logout import (
logoutBlueprint,
logout_blueprint,
)
from routes.passwordReset import (
passwordResetBlueprint,
password_reset_blueprint,
)
from routes.post importpostBlueprint
from routes.post importpost_blueprint
from routes.postsAnalytics import (
analyticsBlueprint,
analytics_blueprint,
)
from routes.privacyPolicy import (
privacyPolicyBlueprint,
privacy_policy_blueprint,
)
from routes.returnPostAnalyticsData import (
returnPostAnalyticsDataBlueprint,
return_post_analytics_data_blueprint,
)
from routes.returnPostBanner import (
returnPostBannerBlueprint,
return_post_banner_blueprint,
)
from routes.search import (
searchBlueprint,
search_blueprint,
)
from routes.searchBar import (
searchBarBlueprint,
search_bar_blueprint,
)
from routes.setLanguage import (
setLanguageBlueprint,
set_language_blueprint,
)
from routes.setTheme import (
setThemeBlueprint,
set_theme_blueprint,
)
from routes.signup import (
signUpBlueprint,
sign_up_blueprint,
)
from routes.user importuserBlueprint
from routes.user importuser_blueprint
from routes.verifyUser import (
verifyUserBlueprint,
verify_user_blueprint,
)
from settings import Settings
from utils.afterRequest import (
afterRequestLogger,
)
from utils.beforeRequest.browserLanguage import browserLanguage
from utils.contextProcessor.isLogin import isLogin
from utils.contextProcessor.isRegistration import isRegistration
from utils.afterRequest import after_request_logger
from utils.beforeRequest.browserLanguage import browser_language
from utils.contextProcessor.isLogin import is_login
from utils.contextProcessor.isRegistration import is_registration
from utils.contextProcessor.markdown import markdown_processor
from utils.contextProcessor.returnPostUrlID import returnPostUrlID
from utils.contextProcessor.returnPostUrlSlug import returnPostUrlSlug
from utils.contextProcessor.returnUserProfilePicture import returnUserProfilePicture
from utils.contextProcessor.translations import injectTranslations
from utils.contextProcessor.markdown import markdown_processor
from utils.contextProcessor.translations import inject_translations
from utils.dbChecker import (
analyticsTable,
commentsTable,
Expand All@@ -123,15 +121,15 @@
from utils.errorHandlers.unauthorizedErrorHandler import (
unauthorizedErrorHandler,
)
from utils.generateUrlIdFromPost importgetSlugFromPostTitle
from utils.generateUrlIdFromPost importget_slug_from_post_title
from utils.log import Log
from utils.terminalASCII importterminalASCII
from utils.time importcurrentTimeStamp
from utils.terminalASCII importterminal_ascii
from utils.time importcurrent_time_stamp

startTime =currentTimeStamp()
start_time =current_time_stamp()


print(terminalASCII())
print(terminal_ascii())


Log.info("Starting...")
Expand All@@ -153,16 +151,16 @@
csrf = CSRFProtect(app)


app.context_processor(isLogin)
app.context_processor(is_login)

app.context_processor(isRegistration)
app.context_processor(is_registration)
app.context_processor(returnUserProfilePicture)
app.context_processor(returnPostUrlID)
app.context_processor(returnPostUrlSlug)
app.context_processor(injectTranslations)
app.context_processor(inject_translations)
app.context_processor(markdown_processor)
app.before_request(browserLanguage)
app.jinja_env.globals.update(getSlugFromPostTitle=getSlugFromPostTitle)
app.before_request(browser_language)
app.jinja_env.globals.update(get_slug_from_post_title=get_slug_from_post_title)

if Settings.WERKZEUG_LOGGER:
Log.warning("Werkzeug default logger is enabled")
Expand DownExpand Up@@ -232,7 +230,7 @@


@app.errorhandler(404)
defnotFound(e):
defnot_found(e):
return notFoundErrorHandler(e)


Expand All@@ -242,13 +240,13 @@ def unauthorized(e):


@app.errorhandler(CSRFError)
defcsrfError(e):
defcsrf_error(e):
return csrfErrorHandler(e)


@app.after_request
defafterRequest(response):
response =afterRequestLogger(response)
defafter_request(response):
response =after_request_logger(response)
response.headers["Content-Security-Policy"] = (
"default-src 'self'; "
"script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://code.jquery.com https://cdn.tailwindcss.com; "
Expand All@@ -259,51 +257,51 @@ def afterRequest(response):
return response


app.register_blueprint(postBlueprint)
app.register_blueprint(userBlueprint)
app.register_blueprint(indexBlueprint)
app.register_blueprint(aboutBlueprint)
app.register_blueprint(loginBlueprint)
app.register_blueprint(signUpBlueprint)
app.register_blueprint(logoutBlueprint)
app.register_blueprint(searchBlueprint)
app.register_blueprint(categoryBlueprint)
app.register_blueprint(editPostBlueprint)
app.register_blueprint(dashboardBlueprint)
app.register_blueprint(searchBarBlueprint)
app.register_blueprint(adminPanelBlueprint)
app.register_blueprint(createPostBlueprint)
app.register_blueprint(verifyUserBlueprint)
app.register_blueprint(setLanguageBlueprint)
app.register_blueprint(setThemeBlueprint)
app.register_blueprint(privacyPolicyBlueprint)
app.register_blueprint(passwordResetBlueprint)
app.register_blueprint(changeUserNameBlueprint)
app.register_blueprint(changePasswordBlueprint)
app.register_blueprint(changeLanguageBlueprint)
app.register_blueprint(adminPanelUsersBlueprint)
app.register_blueprint(adminPanelPostsBlueprint)
app.register_blueprint(accountSettingsBlueprint)
app.register_blueprint(returnPostBannerBlueprint)
app.register_blueprint(adminPanelCommentsBlueprint)
app.register_blueprint(changeProfilePictureBlueprint)
app.register_blueprint(analyticsBlueprint)
app.register_blueprint(returnPostAnalyticsDataBlueprint)
app.register_blueprint(post_blueprint)
app.register_blueprint(user_blueprint)
app.register_blueprint(index_blueprint)
app.register_blueprint(about_blueprint)
app.register_blueprint(login_blueprint)
app.register_blueprint(sign_up_blueprint)
app.register_blueprint(logout_blueprint)
app.register_blueprint(search_blueprint)
app.register_blueprint(category_blueprint)
app.register_blueprint(edit_post_blueprint)
app.register_blueprint(dashboard_blueprint)
app.register_blueprint(search_bar_blueprint)
app.register_blueprint(admin_panel_blueprint)
app.register_blueprint(create_post_blueprint)
app.register_blueprint(verify_user_blueprint)
app.register_blueprint(set_language_blueprint)
app.register_blueprint(set_theme_blueprint)
app.register_blueprint(privacy_policy_blueprint)
app.register_blueprint(password_reset_blueprint)
app.register_blueprint(change_user_name_blueprint)
app.register_blueprint(change_password_blueprint)
app.register_blueprint(change_language_blueprint)
app.register_blueprint(admin_panel_users_blueprint)
app.register_blueprint(admin_panel_posts_blueprint)
app.register_blueprint(account_settings_blueprint)
app.register_blueprint(return_post_banner_blueprint)
app.register_blueprint(admin_panel_comments_blueprint)
app.register_blueprint(change_profile_picture_blueprint)
app.register_blueprint(analytics_blueprint)
app.register_blueprint(return_post_analytics_data_blueprint)


if __name__ == "__main__":
Log.info(f"Running on http://{Settings.APP_HOST}:{Settings.APP_PORT}")
Log.success("App started")

print(terminalASCII())
print(terminal_ascii())
app.run(debug=Settings.DEBUG_MODE, host=Settings.APP_HOST, port=Settings.APP_PORT)

endTime =currentTimeStamp()
runTime =endTime -startTime
runTime = str(timedelta(seconds=runTime))
end_time =current_time_stamp()
run_time =end_time -start_time
run_time = str(timedelta(seconds=run_time))

Log.info(f"Run time: {runTime} ")
Log.info(f"Run time: {run_time} ")
Log.info("Shut down")
Log.warning("App shut down")

print(terminalASCII())
print(terminal_ascii())
Binary file modifiedapp/db/analytics.db
View file
Open in desktop
Binary file not shown.
Binary file modifiedapp/db/comments.db
View file
Open in desktop
Binary file not shown.
Binary file modifiedapp/db/posts.db
View file
Open in desktop
Binary file not shown.
Binary file modifiedapp/db/users.db
View file
Open in desktop
Binary file not shown.
12 changes: 6 additions & 6 deletionsapp/routes/about.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,24 +6,24 @@
from settings import Settings
from utils.log import Log

aboutBlueprint = Blueprint("about", __name__)
about_blueprint = Blueprint("about", __name__)


@aboutBlueprint.route("/about")
@about_blueprint.route("/about")
def about():
"""
This function is used to render the about page.

:paramappName: The name of the application
:typeappName: str
:paramapp_name: The name of the application
:typeapp_name: str
:return: The rendered about page
:rtype: flask.Response
"""

Log.info(
f"Rendering about.html: params:appName={Settings.APP_NAME} andappVersion={Settings.APP_VERSION}"
f"Rendering about.html: params:app_name={Settings.APP_NAME} andapp_version={Settings.APP_VERSION}"
)

return render_template(
"about.html",appName=Settings.APP_NAME,appVersion=Settings.APP_VERSION
"about.html",app_name=Settings.APP_NAME,app_version=Settings.APP_VERSION
)
14 changes: 7 additions & 7 deletionsapp/routes/accountSettings.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,20 +5,20 @@
from utils.delete import Delete
from utils.log import Log

accountSettingsBlueprint = Blueprint("accountSettings", __name__)
account_settings_blueprint = Blueprint("account_settings", __name__)


@accountSettingsBlueprint.route("/accountsettings", methods=["GET", "POST"])
defaccountSettings():
if "userName" in session:
@account_settings_blueprint.route("/account_settings", methods=["GET", "POST"])
defaccount_settings():
if "user_name" in session:
Log.database(f"Connecting to '{Settings.DB_USERS_ROOT}' database")

connection = sqlite3.connect(Settings.DB_USERS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""selectuserName from users whereuserName = ? """,
[(session["userName"])],
"""selectuser_name from users whereuser_name = ? """,
[(session["user_name"])],
)
user = cursor.fetchall()

Expand All@@ -35,4 +35,4 @@ def accountSettings():
f"{request.remote_addr} tried to reach account settings without being logged in"
)

return redirect("/login/redirect=&accountsettings")
return redirect("/login/redirect=&account_settings")
14 changes: 7 additions & 7 deletionsapp/routes/adminPanel.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,25 +4,25 @@
from settings import Settings
from utils.log import Log

adminPanelBlueprint = Blueprint("adminPanel", __name__)
admin_panel_blueprint = Blueprint("admin_panel", __name__)


@adminPanelBlueprint.route("/admin")
defadminPanel():
if "userName" in session:
@admin_panel_blueprint.route("/admin")
defadmin_panel():
if "user_name" in session:
Log.success(f"Connecting to '{Settings.DB_USERS_ROOT}' database")

connection = sqlite3.connect(Settings.DB_USERS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select role from users whereuserName = ? """,
[(session["userName"])],
"""select role from users whereuser_name = ? """,
[(session["user_name"])],
)
role = cursor.fetchone()[0]

if role == "admin":
Log.info(f"Admin: {session['userName']} reached to the admin panel")
Log.info(f"Admin: {session['user_name']} reached to the admin panel")

Log.info("Rendering adminPanel.html: params: None")

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp