aa-structures 2.6.0__py3-none-any.whl → 2.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {aa_structures-2.6.0.dist-info → aa_structures-2.6.2.dist-info}/METADATA +1 -1
  2. {aa_structures-2.6.0.dist-info → aa_structures-2.6.2.dist-info}/RECORD +37 -38
  3. structures/__init__.py +1 -1
  4. structures/admin.py +208 -206
  5. structures/core/notification_embeds/billing_embeds.py +11 -10
  6. structures/core/notification_embeds/character_embeds.py +18 -17
  7. structures/core/notification_embeds/main.py +6 -6
  8. structures/core/notification_embeds/moonmining_embeds.py +25 -26
  9. structures/core/notification_embeds/orbital_embeds.py +8 -7
  10. structures/core/notification_embeds/sov_embeds.py +26 -35
  11. structures/core/notification_embeds/structures_embeds.py +67 -64
  12. structures/core/notification_embeds/tower_embeds.py +29 -22
  13. structures/core/notification_embeds/war_embeds.py +33 -44
  14. structures/core/serializers.py +1 -1
  15. structures/helpers.py +7 -1
  16. structures/locale/de/LC_MESSAGES/django.po +1036 -185
  17. structures/locale/django.pot +1054 -184
  18. structures/locale/en/LC_MESSAGES/django.po +1054 -184
  19. structures/locale/es/LC_MESSAGES/django.po +1035 -184
  20. structures/locale/fr_FR/LC_MESSAGES/django.po +1054 -184
  21. structures/locale/it_IT/LC_MESSAGES/django.po +1054 -184
  22. structures/locale/ja/LC_MESSAGES/django.po +1054 -184
  23. structures/locale/ko_KR/LC_MESSAGES/django.po +1035 -184
  24. structures/locale/ru/LC_MESSAGES/django.mo +0 -0
  25. structures/locale/ru/LC_MESSAGES/django.po +1144 -199
  26. structures/locale/uk/LC_MESSAGES/django.po +1035 -184
  27. structures/locale/zh_Hans/LC_MESSAGES/django.po +1036 -185
  28. structures/migrations/0004_improve_localization.py +401 -0
  29. structures/models/notifications.py +3 -3
  30. structures/models/owners.py +11 -11
  31. structures/models/structures_1.py +16 -16
  32. structures/templates/structures/base.html +1 -1
  33. structures/tests/test_helpers.py +13 -0
  34. structures/views.py +1 -2
  35. structures/webhooks/models.py +14 -5
  36. structures/locale/ko/LC_MESSAGES/django.mo +0 -0
  37. structures/locale/ko/LC_MESSAGES/django.po +0 -2221
  38. {aa_structures-2.6.0.dist-info → aa_structures-2.6.2.dist-info}/LICENSE +0 -0
  39. {aa_structures-2.6.0.dist-info → aa_structures-2.6.2.dist-info}/WHEEL +0 -0
@@ -6,12 +6,13 @@
6
6
  import dhooks_lite
7
7
 
8
8
  from django.db import models
9
- from django.utils.translation import gettext as __
9
+ from django.utils.translation import gettext as _
10
10
  from eveuniverse.models import EveType
11
11
 
12
12
  from app_utils.datetime import ldap_time_2_datetime
13
13
 
14
14
  from structures.constants import EveTypeId
15
+ from structures.helpers import get_or_create_esi_obj
15
16
  from structures.models import Notification, Webhook
16
17
 
17
18
  from .helpers import gen_solar_system_text, target_datetime_formatted
@@ -21,8 +22,8 @@ from .main import NotificationBaseEmbed
21
22
  class BillType(models.IntegerChoices):
22
23
  """A bill type for infrastructure hub bills."""
23
24
 
24
- UNKNOWN = 0, __("Unknown Bill")
25
- INFRASTRUCTURE_HUB = 7, __("Infrastructure Hub Bill")
25
+ UNKNOWN = 0, _("Unknown Bill")
26
+ INFRASTRUCTURE_HUB = 7, _("Infrastructure Hub Bill")
26
27
 
27
28
  @classmethod
28
29
  def to_enum(cls, bill_id: int):
@@ -39,8 +40,8 @@ class NotificationBillingBillOutOfMoneyMsg(NotificationBaseEmbed):
39
40
  bill_type_id = self._parsed_text["billTypeID"]
40
41
  bill_type_str = BillType.to_enum(bill_type_id).label
41
42
  due_date = ldap_time_2_datetime(self._parsed_text["dueDate"])
42
- self._title = __("Insufficient Funds for Bill")
43
- self._description = __(
43
+ self._title = _("Insufficient Funds for Bill")
44
+ self._description = _(
44
45
  "The selected corporation wallet division for automatic payments "
45
46
  "does not have enough current funds available to pay the %(bill_type)s "
46
47
  "due to be paid by %(due_date)s. "
@@ -58,8 +59,8 @@ class NotificationBillingIHubBillAboutToExpire(NotificationBaseEmbed):
58
59
  super().__init__(notification)
59
60
  solar_system_link = gen_solar_system_text(self._notification.eve_solar_system())
60
61
  due_date = ldap_time_2_datetime(self._parsed_text.get("dueDate"))
61
- self._title = __("IHub Bill About to Expire")
62
- self._description = __(
62
+ self._title = _("IHub Bill About to Expire")
63
+ self._description = _(
63
64
  "Maintenance bill for Infrastructure Hub in %(solar_system)s "
64
65
  "expires at %(due_date)s, "
65
66
  "if not paid in time this Infrastructure Hub will self-destruct."
@@ -68,7 +69,7 @@ class NotificationBillingIHubBillAboutToExpire(NotificationBaseEmbed):
68
69
  "due_date": target_datetime_formatted(due_date),
69
70
  }
70
71
  self._color = Webhook.Color.DANGER
71
- structure_type, _ = EveType.objects.get_or_create_esi(id=EveTypeId.IHUB)
72
+ structure_type = get_or_create_esi_obj(EveType, id=EveTypeId.IHUB)
72
73
  self._thumbnail = dhooks_lite.Thumbnail(
73
74
  structure_type.icon_url(size=self.ICON_DEFAULT_SIZE)
74
75
  )
@@ -80,10 +81,10 @@ class NotificationBillingIHubDestroyedByBillFailure(NotificationBaseEmbed):
80
81
  solar_system_link = gen_solar_system_text(self._notification.eve_solar_system())
81
82
  structure_type = self._notification.eve_structure_type()
82
83
  self._title = (
83
- __("%s has self-destructed due to unpaid maintenance bills")
84
+ _("%s has self-destructed due to unpaid maintenance bills")
84
85
  % structure_type.name
85
86
  )
86
- self._description = __(
87
+ self._description = _(
87
88
  "%(structure_type)s in %(solar_system)s has self-destructed, "
88
89
  "as the standard maintenance bills where not paid."
89
90
  ) % {"structure_type": structure_type.name, "solar_system": solar_system_link}
@@ -4,9 +4,10 @@
4
4
 
5
5
  import dhooks_lite
6
6
 
7
- from django.utils.translation import gettext as __
7
+ from django.utils.translation import gettext as _
8
8
  from eveuniverse.models import EveEntity
9
9
 
10
+ from structures.helpers import get_or_create_esi_obj
10
11
  from structures.models import Notification, Webhook
11
12
 
12
13
  from .helpers import (
@@ -20,11 +21,11 @@ from .main import NotificationBaseEmbed
20
21
  class NotificationCorpCharEmbed(NotificationBaseEmbed):
21
22
  def __init__(self, notification: Notification) -> None:
22
23
  super().__init__(notification)
23
- self._character, _ = EveEntity.objects.get_or_create_esi(
24
- id=self._parsed_text["charID"]
24
+ self._character = get_or_create_esi_obj(
25
+ EveEntity, id=self._parsed_text["charID"]
25
26
  )
26
- self._corporation, _ = EveEntity.objects.get_or_create_esi(
27
- id=self._parsed_text["corpID"]
27
+ self._corporation = get_or_create_esi_obj(
28
+ EveEntity, id=self._parsed_text["corpID"]
28
29
  )
29
30
  self._character_link = gen_eve_entity_link(self._character)
30
31
  self._corporation_link = gen_corporation_link(self._corporation.name)
@@ -37,10 +38,10 @@ class NotificationCorpCharEmbed(NotificationBaseEmbed):
37
38
  class NotificationCorpAppNewMsg(NotificationCorpCharEmbed):
38
39
  def __init__(self, notification: Notification) -> None:
39
40
  super().__init__(notification)
40
- self._title = __("New application from %(character_name)s") % {
41
+ self._title = _("New application from %(character_name)s") % {
41
42
  "character_name": self._character.name,
42
43
  }
43
- self._description = __(
44
+ self._description = _(
44
45
  "New application from %(character_name)s to join %(corporation_name)s:\n"
45
46
  "> %(application_text)s"
46
47
  % {
@@ -55,13 +56,13 @@ class NotificationCorpAppNewMsg(NotificationCorpCharEmbed):
55
56
  class NotificationCorpAppInvitedMsg(NotificationCorpCharEmbed):
56
57
  def __init__(self, notification: Notification) -> None:
57
58
  super().__init__(notification)
58
- self._title = __("%(character_name)s has been invited") % {
59
+ self._title = _("%(character_name)s has been invited") % {
59
60
  "character_name": self._character.name
60
61
  }
61
62
  inviting_character = gen_eve_entity_link_from_id(
62
63
  self._parsed_text.get("invokingCharID")
63
64
  )
64
- self._description = __(
65
+ self._description = _(
65
66
  "%(character_name)s has been invited to join %(corporation_name)s "
66
67
  "by %(inviting_character)s.\n"
67
68
  "Application:\n"
@@ -79,10 +80,10 @@ class NotificationCorpAppInvitedMsg(NotificationCorpCharEmbed):
79
80
  class NotificationCorpAppRejectCustomMsg(NotificationCorpCharEmbed):
80
81
  def __init__(self, notification: Notification) -> None:
81
82
  super().__init__(notification)
82
- self._title = __("Rejected application from %(character_name)s") % {
83
+ self._title = _("Rejected application from %(character_name)s") % {
83
84
  "character_name": self._character.name
84
85
  }
85
- self._description = __(
86
+ self._description = _(
86
87
  "Application from %(character_name)s to join %(corporation_name)s:\n"
87
88
  "> %(application_text)s\n"
88
89
  "Has been rejected:\n"
@@ -100,10 +101,10 @@ class NotificationCorpAppRejectCustomMsg(NotificationCorpCharEmbed):
100
101
  class NotificationCharAppWithdrawMsg(NotificationCorpCharEmbed):
101
102
  def __init__(self, notification: Notification) -> None:
102
103
  super().__init__(notification)
103
- self._title = __("%(character_name)s withdrew his/her application") % {
104
+ self._title = _("%(character_name)s withdrew his/her application") % {
104
105
  "character_name": self._character.name,
105
106
  }
106
- self._description = __(
107
+ self._description = _(
107
108
  "%(character_name)s withdrew his/her application to join "
108
109
  "%(corporation_name)s:\n"
109
110
  "> %(application_text)s"
@@ -119,11 +120,11 @@ class NotificationCharAppWithdrawMsg(NotificationCorpCharEmbed):
119
120
  class NotificationCharAppAcceptMsg(NotificationCorpCharEmbed):
120
121
  def __init__(self, notification: Notification) -> None:
121
122
  super().__init__(notification)
122
- self._title = __("%(character_name)s joins %(corporation_name)s") % {
123
+ self._title = _("%(character_name)s joins %(corporation_name)s") % {
123
124
  "character_name": self._character.name,
124
125
  "corporation_name": self._corporation.name,
125
126
  }
126
- self._description = __(
127
+ self._description = _(
127
128
  "%(character_name)s is now a member of %(corporation_name)s."
128
129
  ) % {
129
130
  "character_name": self._character_link,
@@ -135,11 +136,11 @@ class NotificationCharAppAcceptMsg(NotificationCorpCharEmbed):
135
136
  class NotificationCharLeftCorpMsg(NotificationCorpCharEmbed):
136
137
  def __init__(self, notification: Notification) -> None:
137
138
  super().__init__(notification)
138
- self._title = __("%(character_name)s has left %(corporation_name)s") % {
139
+ self._title = _("%(character_name)s has left %(corporation_name)s") % {
139
140
  "character_name": self._character.name,
140
141
  "corporation_name": self._corporation.name,
141
142
  }
142
- self._description = __(
143
+ self._description = _(
143
144
  "%(character_name)s is no longer a member of %(corporation_name)s."
144
145
  ) % {
145
146
  "character_name": self._character_link,
@@ -7,14 +7,14 @@ from typing import Optional
7
7
  import dhooks_lite
8
8
 
9
9
  from django.conf import settings
10
- from django.utils.translation import gettext as __
10
+ from django.utils.translation import gettext as _
11
11
  from eveuniverse.models import EveEntity
12
12
 
13
13
  from app_utils.urls import reverse_absolute, static_file_absolute_url
14
14
 
15
15
  from structures import __title__
16
16
  from structures.core.notification_types import NotificationType
17
- from structures.helpers import is_absolute_url
17
+ from structures.helpers import get_or_create_esi_obj, is_absolute_url
18
18
  from structures.models.notifications import Notification, NotificationBase, Webhook
19
19
 
20
20
  from .helpers import target_datetime_formatted
@@ -59,9 +59,9 @@ class NotificationBaseEmbed:
59
59
  def compile_damage_text(self, field_postfix: str, factor: int = 1) -> str:
60
60
  """Compile damage text for Structures and POSes"""
61
61
  damage_labels = [
62
- ("shield", __("shield")),
63
- ("armor", __("armor")),
64
- ("hull", __("hull")),
62
+ ("shield", _("shield")),
63
+ ("armor", _("armor")),
64
+ ("hull", _("hull")),
65
65
  ]
66
66
  damage_parts = []
67
67
  for prop in damage_labels:
@@ -83,7 +83,7 @@ class NotificationBaseEmbed:
83
83
  key = "aggressorID"
84
84
  else:
85
85
  return "(Unknown aggressor)"
86
- entity, _ = EveEntity.objects.get_or_create_esi(id=self._parsed_text[key])
86
+ entity = get_or_create_esi_obj(EveEntity, id=self._parsed_text[key])
87
87
  return Webhook.create_link(entity.name, entity.profile_url)
88
88
 
89
89
  def fuel_expires_target_date(self) -> str:
@@ -5,12 +5,13 @@
5
5
 
6
6
  import dhooks_lite
7
7
 
8
- from django.utils.translation import gettext as __
8
+ from django.utils.translation import gettext as _
9
9
  from eveuniverse.models import EveEntity, EveType
10
10
 
11
11
  from app_utils.datetime import ldap_time_2_datetime
12
12
 
13
13
  from structures.app_settings import STRUCTURES_NOTIFICATION_SHOW_MOON_ORE
14
+ from structures.helpers import get_or_create_esi_obj
14
15
  from structures.models import Notification, Webhook
15
16
 
16
17
  from .helpers import (
@@ -37,7 +38,7 @@ class NotificationMoonminingEmbed(NotificationBaseEmbed):
37
38
  structure_type.icon_url(size=self.ICON_DEFAULT_SIZE)
38
39
  )
39
40
  self.ore_text = (
40
- __("\nEstimated ore composition: %s") % self._ore_composition_text()
41
+ _("Estimated ore composition: %s") % self._ore_composition_text()
41
42
  if STRUCTURES_NOTIFICATION_SHOW_MOON_ORE
42
43
  else ""
43
44
  )
@@ -48,7 +49,7 @@ class NotificationMoonminingEmbed(NotificationBaseEmbed):
48
49
 
49
50
  ore_list = []
50
51
  for ore_type_id, volume in self._parsed_text["oreVolumeByType"].items():
51
- ore_type, _ = EveType.objects.get_or_create_esi(id=ore_type_id)
52
+ ore_type = get_or_create_esi_obj(EveType, id=ore_type_id)
52
53
  if ore_type:
53
54
  ore_list.append(
54
55
  {"id": ore_type_id, "name": ore_type.name, "volume": volume}
@@ -63,20 +64,18 @@ class NotificationMoonminingEmbed(NotificationBaseEmbed):
63
64
  class NotificationMoonminningExtractionStarted(NotificationMoonminingEmbed):
64
65
  def __init__(self, notification: Notification) -> None:
65
66
  super().__init__(notification)
66
- started_by, _ = EveEntity.objects.get_or_create_esi(
67
- id=self._parsed_text["startedBy"]
68
- )
67
+ started_by = get_or_create_esi_obj(EveEntity, id=self._parsed_text["startedBy"])
69
68
  ready_time = ldap_time_2_datetime(self._parsed_text["readyTime"])
70
69
  auto_time = ldap_time_2_datetime(self._parsed_text["autoTime"])
71
- self._title = __("Moon mining extraction started")
72
- self._description = __(
70
+ self._title = _("Moon mining extraction started")
71
+ self._description = _(
73
72
  "A moon mining extraction has been started "
74
73
  "for %(structure_name)s at %(moon)s in %(solar_system)s "
75
74
  "belonging to %(owner_link)s. "
76
75
  "Extraction was started by %(character)s.\n"
77
76
  "The chunk will be ready on location at %(ready_time)s, "
78
77
  "and will fracture automatically on %(auto_time)s.\n"
79
- "%(ore_text)s"
78
+ "\n%(ore_text)s"
80
79
  ) % {
81
80
  "structure_name": Webhook.text_bold(self._structure_name),
82
81
  "moon": self._moon.name,
@@ -94,14 +93,14 @@ class NotificationMoonminningExtractionFinished(NotificationMoonminingEmbed):
94
93
  def __init__(self, notification: Notification) -> None:
95
94
  super().__init__(notification)
96
95
  auto_time = ldap_time_2_datetime(self._parsed_text["autoTime"])
97
- self._title = __("Extraction finished")
98
- self._description = __(
96
+ self._title = _("Extraction finished")
97
+ self._description = _(
99
98
  "The extraction for %(structure_name)s at %(moon)s "
100
99
  "in %(solar_system)s belonging to %(owner_link)s "
101
100
  "is finished and the chunk is ready "
102
101
  "to be shot at.\n"
103
102
  "The chunk will automatically fracture on %(auto_time)s.\n"
104
- "%(ore_text)s"
103
+ "\n%(ore_text)s"
105
104
  ) % {
106
105
  "structure_name": Webhook.text_bold(self._structure_name),
107
106
  "moon": self._moon.name,
@@ -116,13 +115,13 @@ class NotificationMoonminningExtractionFinished(NotificationMoonminingEmbed):
116
115
  class NotificationMoonminningAutomaticFracture(NotificationMoonminingEmbed):
117
116
  def __init__(self, notification: Notification) -> None:
118
117
  super().__init__(notification)
119
- self._title = __("Automatic Fracture")
120
- self._description = __(
118
+ self._title = _("Automatic Fracture")
119
+ self._description = _(
121
120
  "The moon drill fitted to %(structure_name)s at %(moon)s"
122
121
  " in %(solar_system)s belonging to %(owner_link)s "
123
122
  "has automatically been fired "
124
123
  "and the moon products are ready to be harvested.\n"
125
- "%(ore_text)s"
124
+ "\n%(ore_text)s"
126
125
  ) % {
127
126
  "structure_name": Webhook.text_bold(self._structure_name),
128
127
  "moon": self._moon.name,
@@ -137,13 +136,13 @@ class NotificationMoonminningExtractionCanceled(NotificationMoonminingEmbed):
137
136
  def __init__(self, notification: Notification) -> None:
138
137
  super().__init__(notification)
139
138
  if self._parsed_text["cancelledBy"]:
140
- cancelled_by, _ = EveEntity.objects.get_or_create_esi(
141
- id=self._parsed_text["cancelledBy"]
139
+ cancelled_by = get_or_create_esi_obj(
140
+ EveEntity, id=self._parsed_text["cancelledBy"]
142
141
  )
143
142
  else:
144
- cancelled_by = __("(unknown)")
145
- self._title = __("Extraction cancelled")
146
- self._description = __(
143
+ cancelled_by = _("(unknown)")
144
+ self._title = _("Extraction cancelled")
145
+ self._description = _(
147
146
  "An ongoing extraction for %(structure_name)s at %(moon)s "
148
147
  "in %(solar_system)s belonging to %(owner_link)s "
149
148
  "has been cancelled by %(character)s."
@@ -160,16 +159,16 @@ class NotificationMoonminningExtractionCanceled(NotificationMoonminingEmbed):
160
159
  class NotificationMoonminningLaserFired(NotificationMoonminingEmbed):
161
160
  def __init__(self, notification: Notification) -> None:
162
161
  super().__init__(notification)
163
- fired_by, _ = EveEntity.objects.get_or_create_esi(
164
- id=self._parsed_text["firedBy"]
165
- )
166
- self._title = __("Moon drill fired")
167
- self._description = __(
162
+ fired_by = EveEntity.objects.get_or_create_esi(id=self._parsed_text["firedBy"])[
163
+ 0
164
+ ]
165
+ self._title = _("Moon drill fired")
166
+ self._description = _(
168
167
  "The moon drill fitted to %(structure_name)s at %(moon)s "
169
168
  "in %(solar_system)s belonging to %(owner_link)s "
170
169
  "has been fired by %(character)s "
171
170
  "and the moon products are ready to be harvested.\n"
172
- "%(ore_text)s"
171
+ "\n%(ore_text)s"
173
172
  ) % {
174
173
  "structure_name": Webhook.text_bold(self._structure_name),
175
174
  "moon": self._moon.name,
@@ -4,12 +4,13 @@
4
4
 
5
5
  import dhooks_lite
6
6
 
7
- from django.utils.translation import gettext as __
7
+ from django.utils.translation import gettext as _
8
8
  from eveuniverse.models import EveType
9
9
 
10
10
  from app_utils.datetime import ldap_time_2_datetime
11
11
 
12
12
  from structures.constants import EveTypeId
13
+ from structures.helpers import get_or_create_esi_obj
13
14
  from structures.models import Notification, Webhook
14
15
 
15
16
  from .helpers import (
@@ -26,8 +27,8 @@ class NotificationOrbitalEmbed(NotificationBaseEmbed):
26
27
  def __init__(self, notification: Notification) -> None:
27
28
  super().__init__(notification)
28
29
  self._planet = self._notification.eve_planet()
29
- self._structure_type, _ = EveType.objects.get_or_create_esi(
30
- id=EveTypeId.CUSTOMS_OFFICE
30
+ self._structure_type = get_or_create_esi_obj(
31
+ EveType, id=EveTypeId.CUSTOMS_OFFICE
31
32
  )
32
33
  self._solar_system_link = gen_solar_system_text(
33
34
  self._notification.eve_solar_system()
@@ -42,8 +43,8 @@ class NotificationOrbitalEmbed(NotificationBaseEmbed):
42
43
  class NotificationOrbitalAttacked(NotificationOrbitalEmbed):
43
44
  def __init__(self, notification: Notification) -> None:
44
45
  super().__init__(notification)
45
- self._title = __("Orbital under attack")
46
- self._description = __(
46
+ self._title = _("Orbital under attack")
47
+ self._description = _(
47
48
  "The %(structure_type)s at %(planet)s in %(solar_system)s "
48
49
  "belonging to %(owner_link)s "
49
50
  "is under attack by %(aggressor)s."
@@ -63,8 +64,8 @@ class NotificationOrbitalReinforced(NotificationOrbitalEmbed):
63
64
  reinforce_exit_time = ldap_time_2_datetime(
64
65
  self._parsed_text["reinforceExitTime"]
65
66
  )
66
- self._title = __("Orbital reinforced")
67
- self._description = __(
67
+ self._title = _("Orbital reinforced")
68
+ self._description = _(
68
69
  "The %(structure_type)s at %(planet)s in %(solar_system)s "
69
70
  "belonging to %(owner_link)s "
70
71
  "has been reinforced by %(aggressor)s "
@@ -4,13 +4,14 @@
4
4
 
5
5
  import dhooks_lite
6
6
 
7
- from django.utils.translation import gettext as __
7
+ from django.utils.translation import gettext as _
8
8
  from eveuniverse.models import EveEntity, EveMoon, EveType
9
9
 
10
10
  from app_utils.datetime import ldap_time_2_datetime
11
11
 
12
12
  from structures.constants import EveTypeId
13
13
  from structures.core import sovereignty
14
+ from structures.helpers import get_or_create_esi_obj
14
15
  from structures.models import Notification, Webhook
15
16
 
16
17
  from .helpers import (
@@ -38,7 +39,7 @@ class NotificationSovEmbed(NotificationBaseEmbed):
38
39
  )
39
40
  else:
40
41
  structure_type_id = EveTypeId.TCU
41
- structure_type, _ = EveType.objects.get_or_create_esi(id=structure_type_id)
42
+ structure_type = get_or_create_esi_obj(EveType, id=structure_type_id)
42
43
  self._structure_type_name = structure_type.name
43
44
  try:
44
45
  self._sov_owner_link = gen_alliance_link(notification.sender.name)
@@ -52,11 +53,11 @@ class NotificationSovEmbed(NotificationBaseEmbed):
52
53
  class NotificationSovEntosisCaptureStarted(NotificationSovEmbed):
53
54
  def __init__(self, notification: Notification) -> None:
54
55
  super().__init__(notification)
55
- self._title = __("%(structure_type)s in %(solar_system)s is being captured") % {
56
+ self._title = _("%(structure_type)s in %(solar_system)s is being captured") % {
56
57
  "structure_type": Webhook.text_bold(self._structure_type_name),
57
58
  "solar_system": self._solar_system.name,
58
59
  }
59
- self._description = __(
60
+ self._description = _(
60
61
  "A capsuleer has started to influence the %(type)s "
61
62
  "in %(solar_system)s belonging to %(owner)s "
62
63
  "with an Entosis Link."
@@ -71,14 +72,14 @@ class NotificationSovEntosisCaptureStarted(NotificationSovEmbed):
71
72
  class NotificationSovCommandNodeEventStarted(NotificationSovEmbed):
72
73
  def __init__(self, notification: Notification) -> None:
73
74
  super().__init__(notification)
74
- self._title = __(
75
+ self._title = _(
75
76
  "Command nodes for %(structure_type)s in %(solar_system)s "
76
77
  "have begun to decloak"
77
78
  ) % {
78
79
  "structure_type": Webhook.text_bold(self._structure_type_name),
79
80
  "solar_system": self._solar_system.name,
80
81
  }
81
- self._description = __(
82
+ self._description = _(
82
83
  "Command nodes for %(structure_type)s in %(solar_system)s "
83
84
  "belonging to %(owner)s can now be found throughout "
84
85
  "the %(constellation)s constellation"
@@ -94,16 +95,12 @@ class NotificationSovCommandNodeEventStarted(NotificationSovEmbed):
94
95
  class NotificationSovAllClaimAcquiredMsg(NotificationSovEmbed):
95
96
  def __init__(self, notification: Notification) -> None:
96
97
  super().__init__(notification)
97
- alliance, _ = EveEntity.objects.get_or_create_esi(
98
- id=self._parsed_text["allianceID"]
99
- )
100
- corporation, _ = EveEntity.objects.get_or_create_esi(
101
- id=self._parsed_text["corpID"]
102
- )
98
+ alliance = get_or_create_esi_obj(EveEntity, id=self._parsed_text["allianceID"])
99
+ corporation = get_or_create_esi_obj(EveEntity, id=self._parsed_text["corpID"])
103
100
  self._title = (
104
- __("DED Sovereignty claim acknowledgment: %s") % self._solar_system.name
101
+ _("DED Sovereignty claim acknowledgment: %s") % self._solar_system.name
105
102
  )
106
- self._description = __(
103
+ self._description = _(
107
104
  "DED now officially acknowledges that your "
108
105
  "member corporation %(corporation)s has claimed "
109
106
  "sovereignty on behalf of %(alliance)s in %(solar_system)s."
@@ -118,14 +115,10 @@ class NotificationSovAllClaimAcquiredMsg(NotificationSovEmbed):
118
115
  class NotificationSovAllClaimLostMsg(NotificationSovEmbed):
119
116
  def __init__(self, notification: Notification) -> None:
120
117
  super().__init__(notification)
121
- alliance, _ = EveEntity.objects.get_or_create_esi(
122
- id=self._parsed_text["allianceID"]
123
- )
124
- corporation, _ = EveEntity.objects.get_or_create_esi(
125
- id=self._parsed_text["corpID"]
126
- )
127
- self._title = __("Lost sovereignty in: %s") % self._solar_system.name
128
- self._description = __(
118
+ alliance = get_or_create_esi_obj(EveEntity, id=self._parsed_text["allianceID"])
119
+ corporation = get_or_create_esi_obj(EveEntity, id=self._parsed_text["corpID"])
120
+ self._title = _("Lost sovereignty in: %s") % self._solar_system.name
121
+ self._description = _(
129
122
  "DED acknowledges that member corporation %(corporation)s has lost its "
130
123
  "claim to sovereignty on behalf of %(alliance)s in %(solar_system)s."
131
124
  ) % {
@@ -140,13 +133,13 @@ class NotificationSovStructureReinforced(NotificationSovEmbed):
140
133
  def __init__(self, notification: Notification) -> None:
141
134
  super().__init__(notification)
142
135
  timer_starts = ldap_time_2_datetime(self._parsed_text["decloakTime"])
143
- self._title = __(
136
+ self._title = _(
144
137
  "%(structure_type)s in %(solar_system)s has entered reinforced mode"
145
138
  ) % {
146
139
  "structure_type": Webhook.text_bold(self._structure_type_name),
147
140
  "solar_system": self._solar_system.name,
148
141
  }
149
- self._description = __(
142
+ self._description = _(
150
143
  "The %(structure_type)s in %(solar_system)s belonging "
151
144
  "to %(owner)s has been reinforced by "
152
145
  "hostile forces and command nodes "
@@ -163,13 +156,11 @@ class NotificationSovStructureReinforced(NotificationSovEmbed):
163
156
  class NotificationSovStructureDestroyed(NotificationSovEmbed):
164
157
  def __init__(self, notification: Notification) -> None:
165
158
  super().__init__(notification)
166
- self._title = __(
167
- "%(structure_type)s in %(solar_system)s has been destroyed"
168
- ) % {
159
+ self._title = _("%(structure_type)s in %(solar_system)s has been destroyed") % {
169
160
  "structure_type": Webhook.text_bold(self._structure_type_name),
170
161
  "solar_system": self._solar_system.name,
171
162
  }
172
- self._description = __(
163
+ self._description = _(
173
164
  "The command nodes for %(structure_type)s "
174
165
  "in %(solar_system)s belonging to %(owner)s have been "
175
166
  "destroyed by hostile forces."
@@ -184,13 +175,13 @@ class NotificationSovStructureDestroyed(NotificationSovEmbed):
184
175
  class NotificationSovAllAnchoringMsg(NotificationBaseEmbed):
185
176
  def __init__(self, notification: Notification) -> None:
186
177
  super().__init__(notification)
187
- corporation, _ = EveEntity.objects.get_or_create_esi(
188
- id=self._parsed_text.get("corpID")
178
+ corporation = get_or_create_esi_obj(
179
+ EveEntity, id=self._parsed_text.get("corpID")
189
180
  )
190
181
  corp_link = gen_eve_entity_link(corporation)
191
182
  alliance_id = self._parsed_text.get("allianceID")
192
183
  if alliance_id:
193
- alliance, _ = EveEntity.objects.get_or_create_esi(id=alliance_id)
184
+ alliance = get_or_create_esi_obj(EveEntity, id=alliance_id)
194
185
  structure_owner = f"{corp_link} ({alliance.name})"
195
186
  else:
196
187
  structure_owner = corp_link
@@ -198,15 +189,15 @@ class NotificationSovAllAnchoringMsg(NotificationBaseEmbed):
198
189
  structure_type = self._notification.eve_structure_type("typeID")
199
190
  moon_id = self._parsed_text.get("moonID")
200
191
  if moon_id:
201
- eve_moon, _ = EveMoon.objects.get_or_create_esi(id=moon_id)
202
- location_text = __(" near **%s**") % eve_moon.name
192
+ eve_moon = get_or_create_esi_obj(EveMoon, id=moon_id)
193
+ location_text = _(" near **%s**") % eve_moon.name
203
194
  else:
204
195
  location_text = ""
205
- self._title = __("%(structure_type)s anchored in %(solar_system)s") % {
196
+ self._title = _("%(structure_type)s anchored in %(solar_system)s") % {
206
197
  "structure_type": structure_type.eve_group.name,
207
198
  "solar_system": eve_solar_system.name,
208
199
  }
209
- self._description = __(
200
+ self._description = _(
210
201
  "A %(structure_type)s from %(structure_owner)s has anchored "
211
202
  "in %(solar_system)s%(location_text)s."
212
203
  ) % {