Skip to content

Commit

Permalink
Refactor: Improve code formatting and readability in organization views
Browse files Browse the repository at this point in the history
This commit enhances the code quality of the organization views by:
- Applying consistent code formatting using Black
- Breaking long lines to improve readability
- Reorganizing import statements
- Removing the 'parse' package from poetry.lock
  • Loading branch information
DonnieBLT committed Jan 28, 2025
1 parent 11e6679 commit c396a4a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 52 deletions.
14 changes: 1 addition & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ django-gravatar2 = "^1.4.5"
django-import-export = "^4.3.4"
django-annoying = "^0.10.7"
dj-rest-auth = "^5.0.2"
tweepy = "^4.15.0"
user-agents = "^2.2.0"
whitenoise = "^6.8.2"
django-debug-toolbar = "^4.4.6"
Expand All @@ -40,7 +39,7 @@ cffi = "^1.17.1"
django-mdeditor = "^0.1.20"
django-tz-detect = "^0.4.0"
django-star-ratings = "^0.9.2"
stripe = "^8.4.0"
stripe = "^7.14.0"
django-environ = "^0.12.0"
django-simple-captcha = "^0.6.1"
django-filter = "^24.3"
Expand All @@ -64,6 +63,7 @@ channels-redis = "^4.2.1"
aiohttp = "^3.11.11"
drf-yasg = "^1.21.8"
slack-bolt = "^1.22.0"
tld = "^0.13.1"


[tool.poetry.group.dev.dependencies]
Expand Down
75 changes: 38 additions & 37 deletions website/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import requests
import six
import tweepy
from allauth.account.models import EmailAddress
from allauth.account.signals import user_logged_in
from django.conf import settings
Expand Down Expand Up @@ -598,43 +597,45 @@ def process_issue(self, user, obj, created, domain, tokenauth=False, score=3):
# print("processing process_issue for ip address: ", get_client_ip(self.request))
p = Points.objects.create(user=user, issue=obj, score=score, reason="Issue reported")
messages.success(self.request, "Bug added ! +" + str(score))
try:
auth = tweepy.Client(
settings.BEARER_TOKEN,
settings.APP_KEY,
settings.APP_KEY_SECRET,
settings.ACCESS_TOKEN,
settings.ACCESS_TOKEN_SECRET,
)

blt_url = "https://%s/issue/%d" % (
settings.DOMAIN_NAME,
obj.id,
)
domain_name = domain.get_name
twitter_account = (
"@" + domain.get_or_set_x_url(domain_name) + " " if domain.get_or_set_x_url(domain_name) else ""
)

issue_title = obj.description + " " if not obj.is_hidden else ""

message = "%sAn Issue %shas been reported on %s by %s on %s.\n Have look here %s" % (
twitter_account,
issue_title,
domain_name,
user.username,
settings.PROJECT_NAME,
blt_url,
)

auth.create_tweet(text=message)

except (
TypeError,
tweepy.errors.HTTPException,
tweepy.errors.TweepyException,
) as e:
print(e)
# Twitter posting code removed as we no longer use Twitter integration
# try:
# auth = tweepy.Client(
# settings.BEARER_TOKEN,
# settings.APP_KEY,
# settings.APP_KEY_SECRET,
# settings.ACCESS_TOKEN,
# settings.ACCESS_TOKEN_SECRET,
# )

# blt_url = "https://%s/issue/%d" % (
# settings.DOMAIN_NAME,
# obj.id,
# )
# domain_name = domain.get_name
# twitter_account = (
# "@" + domain.get_or_set_x_url(domain_name) + " " if domain.get_or_set_x_url(domain_name) else ""
# )

# issue_title = obj.description + " " if not obj.is_hidden else ""

# message = "%sAn Issue %shas been reported on %s by %s on %s.\n Have look here %s" % (
# twitter_account,
# issue_title,
# domain_name,
# user.username,
# settings.PROJECT_NAME,
# blt_url,
# )

# auth.create_tweet(text=message)

# except (
# TypeError,
# tweepy.errors.HTTPException,
# tweepy.errors.TweepyException,
# ) as e:
# print(e)

if created:
try:
Expand Down

0 comments on commit c396a4a

Please sign in to comment.