aa-structures 2.6.1__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 (27) hide show
  1. {aa_structures-2.6.1.dist-info → aa_structures-2.6.2.dist-info}/METADATA +1 -1
  2. {aa_structures-2.6.1.dist-info → aa_structures-2.6.2.dist-info}/RECORD +27 -27
  3. structures/__init__.py +1 -1
  4. structures/core/notification_embeds/billing_embeds.py +2 -1
  5. structures/core/notification_embeds/character_embeds.py +7 -6
  6. structures/core/notification_embeds/main.py +2 -2
  7. structures/core/notification_embeds/moonmining_embeds.py +11 -12
  8. structures/core/notification_embeds/orbital_embeds.py +4 -3
  9. structures/core/notification_embeds/sov_embeds.py +9 -17
  10. structures/core/notification_embeds/structures_embeds.py +27 -23
  11. structures/core/notification_embeds/tower_embeds.py +16 -10
  12. structures/locale/de/LC_MESSAGES/django.po +493 -46
  13. structures/locale/django.pot +502 -46
  14. structures/locale/en/LC_MESSAGES/django.po +502 -46
  15. structures/locale/es/LC_MESSAGES/django.po +493 -46
  16. structures/locale/fr_FR/LC_MESSAGES/django.po +502 -46
  17. structures/locale/it_IT/LC_MESSAGES/django.po +502 -46
  18. structures/locale/ja/LC_MESSAGES/django.po +502 -46
  19. structures/locale/ko_KR/LC_MESSAGES/django.po +493 -46
  20. structures/locale/ru/LC_MESSAGES/django.mo +0 -0
  21. structures/locale/ru/LC_MESSAGES/django.po +562 -52
  22. structures/locale/uk/LC_MESSAGES/django.po +493 -46
  23. structures/locale/zh_Hans/LC_MESSAGES/django.po +493 -46
  24. structures/templates/structures/base.html +1 -1
  25. structures/views.py +0 -1
  26. {aa_structures-2.6.1.dist-info → aa_structures-2.6.2.dist-info}/LICENSE +0 -0
  27. {aa_structures-2.6.1.dist-info → aa_structures-2.6.2.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aa-structures
3
- Version: 2.6.1
3
+ Version: 2.6.2
4
4
  Summary: App for managing Eve Online structures with Alliance Auth.
5
5
  Author-email: Erik Kalkoken <kalkoken87@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -1,4 +1,4 @@
1
- structures/__init__.py,sha256=fgJiF9Ghh5QJwUoTRlznhNcBZDRZOjj2F_V4zDhCVvk,203
1
+ structures/__init__.py,sha256=KOKNTOpenIiuO_fDHTBNBibijr_3uh2Y7JptMnk0dVM,203
2
2
  structures/admin.py,sha256=t6-f7c-eUFeg1NKGVhYmypbLKVlTSmRZXVXPIdGPe7E,37409
3
3
  structures/app_settings.py,sha256=nNERL_qmuaa8EkzvT3rzVD8KhKeajS0fRaTPK4suArM,6267
4
4
  structures/apps.py,sha256=MNZH9l3qWCwuS7OGiKGkBVrDzKoOFlqwDdEgyEFzxVA,195
@@ -10,7 +10,7 @@ structures/managers.py,sha256=y5yasAI25pjGP1iEc5evJ49thOh4xggv6bU3XaVcMW4,19003
10
10
  structures/providers.py,sha256=9QYHd8X5HwBhrbgbX3LUrXXV1KGM3hFhcxK6qIJjJtg,317
11
11
  structures/tasks.py,sha256=JAbTUUodVmn8J3b23Z2VzMV8_CeOem4ZHcksq29uJyY,9061
12
12
  structures/urls.py,sha256=fMct2Q-CFdMlteFfzAvMoEs5ynXD8vQvABQO3WkAtlY,1086
13
- structures/views.py,sha256=Dm-PxMGod2oR7MHO8dz6T-FUcRyt_lWfKiNhtHFdboU,22044
13
+ structures/views.py,sha256=sOFwVlwpWme0huiZPuRkFdlSBFocvBblbb7Pem9yDD4,22011
14
14
  structures/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  structures/core/notification_timers.py,sha256=G-QwpqP9HFv_Y7KsID9bLF-GluEJ1-duSJQN-zqJtM0,14977
16
16
  structures/core/notification_types.py,sha256=CL5f8NUdn6hXqW9JEvKpch-2VSgczC3mpjIXlFwwaXQ,11199
@@ -18,37 +18,37 @@ structures/core/serializers.py,sha256=tHuLk4yf9R562qHMjAX_IjDp4hgSWa8lvsUopE11Hx
18
18
  structures/core/sovereignty.py,sha256=XKgjAFO4BfLpEEUz_hBr2DVDnvWBq9sL9EEQiT4T0n0,730
19
19
  structures/core/starbases.py,sha256=nw7skHYATrnAV-zuPAuxmhM5E4Aqjc_DHSU2TYWgBng,1757
20
20
  structures/core/notification_embeds/__init__.py,sha256=30cpjKLZ5_OFtXDACDcjvWQAYszM2BrYxUYb5PRQoTA,131
21
- structures/core/notification_embeds/billing_embeds.py,sha256=u38QeFQNpaXiYLYSM9f_LyYDM841boKfikX-S1p1B6o,3733
22
- structures/core/notification_embeds/character_embeds.py,sha256=tQrJXK-qYjckgVnnCrAPa7fUksh0N2muhoeDeSnAsHg,5594
21
+ structures/core/notification_embeds/billing_embeds.py,sha256=PGCdBDfi8JABv5WR0uyNgsAA922mAP3O-y7mQ-yhGH0,3780
22
+ structures/core/notification_embeds/character_embeds.py,sha256=BCGser4iZb4di6DOfRAeQLhPydCvA6-kBOjXwlUmRUw,5635
23
23
  structures/core/notification_embeds/helpers.py,sha256=0SlrLLFyV0IrdOYfIOLQs0xZgzK8bO7Iroqh7dZnm98,2974
24
- structures/core/notification_embeds/main.py,sha256=fWomTsKBzRbvXy1x-DucB4Za_Bv8OtQHO1cLqv8vtuM,13484
25
- structures/core/notification_embeds/moonmining_embeds.py,sha256=zl9QhvcdgCK3KgTIGP2_UDDhLzk3YdaaS_uhiLrORPY,7294
26
- structures/core/notification_embeds/orbital_embeds.py,sha256=h9RtUMYcslXb5FrUIJmnqybXSWpMo4ifTpntRcpmPNQ,2914
27
- structures/core/notification_embeds/sov_embeds.py,sha256=65ULOPPlc9p_whItLNriGECZ0hGIkYdi3Yh6aTccf1M,9137
28
- structures/core/notification_embeds/structures_embeds.py,sha256=x9Z4k7mGUMr8oavWEF-dcxTGvOJkQtnS-zdEcCrCuck,13178
29
- structures/core/notification_embeds/tower_embeds.py,sha256=r6LH1I-Jhdxlj-4qAlHG20TAtVc4K8zR56N8YOVdiP4,5743
24
+ structures/core/notification_embeds/main.py,sha256=Pr_VdNmfZfP_JsY3e-mY2okDPm6LBGTrWPy_3BhrN_8,13501
25
+ structures/core/notification_embeds/moonmining_embeds.py,sha256=65psg46D2jGgtC-TIjkBtPUHhjSdqYKZaO5GPwenJCQ,7313
26
+ structures/core/notification_embeds/orbital_embeds.py,sha256=0By9aYJx2hInazvMx5eVJvDkSXcND5ztURfKVPuWZjQ,2961
27
+ structures/core/notification_embeds/sov_embeds.py,sha256=3UI2xcfrfBJYizxJLX16MSx57rbAlHWdGhcZx34gh38,9007
28
+ structures/core/notification_embeds/structures_embeds.py,sha256=QCtKdNh-UYLqQTFkZpr-3xtTNzJ6_XKm18-BBIsA6yA,13369
29
+ structures/core/notification_embeds/tower_embeds.py,sha256=etUR9I0VTtAyLX3EWqUZAzte1MaXasLYIgFqCQ1qjnI,5869
30
30
  structures/core/notification_embeds/war_embeds.py,sha256=Qc-RUuuSmT1EBkV9D-_vZQ5QX30UGLow2PonC-wBO6U,9050
31
- structures/locale/django.pot,sha256=jdx-h1A8UXeEujz1vrA6Ei8XsnsM8idlZM4t1vqseFs,46273
31
+ structures/locale/django.pot,sha256=gJ_fSJvJjZ9WQC5X3Y-D82nkPOWxPiMIMd5atvBuYYo,58740
32
32
  structures/locale/de/LC_MESSAGES/django.mo,sha256=SPRb-Sy7v4zt56YPqZ13E-oNglUV8g7q0TDZuF9afek,4495
33
- structures/locale/de/LC_MESSAGES/django.po,sha256=N2sETF5NncNOVfhicRx8CY7sABOybstYOzfBl3pQP3M,47720
33
+ structures/locale/de/LC_MESSAGES/django.po,sha256=BgJZlXwAwxYe6jcS4eRndTUNGo6hX9imcUNKW-DMcSo,60160
34
34
  structures/locale/en/LC_MESSAGES/django.mo,sha256=N1pb17IfLd0ASiKO8d68-B4ygSpDkhKOCs8YTzMXQo0,380
35
- structures/locale/en/LC_MESSAGES/django.po,sha256=0b9L0QD6eAaWgEJ3DK_8ainiQgMkcwq9bKtLxaWsqek,46320
35
+ structures/locale/en/LC_MESSAGES/django.po,sha256=vjAEpVbQH-NIBTkrk7ykT3ScFAxJEmo2KXU0_vpm7Rc,58787
36
36
  structures/locale/es/LC_MESSAGES/django.mo,sha256=htEILnvb29fbtfWUHaalRhIU1kx7ylRarFNgXjNYBuk,871
37
- structures/locale/es/LC_MESSAGES/django.po,sha256=58TncdktF9ciU2FQ3Q1OSZK9o2CXNBPrMJnXLqpuWVU,46565
37
+ structures/locale/es/LC_MESSAGES/django.po,sha256=0yAN0Hb0ZKgmgNeUOUEW30C_PaMNVzDhW4aPegCE7z0,59005
38
38
  structures/locale/fr_FR/LC_MESSAGES/django.mo,sha256=UXCQbz2AxBvh-IQ7bGgjoBnijo8h9DfE9107A-2Mgkk,337
39
- structures/locale/fr_FR/LC_MESSAGES/django.po,sha256=jdx-h1A8UXeEujz1vrA6Ei8XsnsM8idlZM4t1vqseFs,46273
39
+ structures/locale/fr_FR/LC_MESSAGES/django.po,sha256=gJ_fSJvJjZ9WQC5X3Y-D82nkPOWxPiMIMd5atvBuYYo,58740
40
40
  structures/locale/it_IT/LC_MESSAGES/django.mo,sha256=UXCQbz2AxBvh-IQ7bGgjoBnijo8h9DfE9107A-2Mgkk,337
41
- structures/locale/it_IT/LC_MESSAGES/django.po,sha256=jdx-h1A8UXeEujz1vrA6Ei8XsnsM8idlZM4t1vqseFs,46273
41
+ structures/locale/it_IT/LC_MESSAGES/django.po,sha256=gJ_fSJvJjZ9WQC5X3Y-D82nkPOWxPiMIMd5atvBuYYo,58740
42
42
  structures/locale/ja/LC_MESSAGES/django.mo,sha256=XMj5I8Aah7EGpU-KfFOr25hoOxxLT5dfmjror1-uc8g,373
43
- structures/locale/ja/LC_MESSAGES/django.po,sha256=ixz4NOW8ZoWDnJQS6-V3nEnzfYrPBud5o7k6GL9PtQs,46313
43
+ structures/locale/ja/LC_MESSAGES/django.po,sha256=_fj8dXozLcWSfrh3COs_MaAJQajXgVPF9i8kq4bRsJo,58780
44
44
  structures/locale/ko_KR/LC_MESSAGES/django.mo,sha256=Oq6yqHS8xGE_0aqbnmLnzZaLWWbLiapC0_S4tmdLDqA,391
45
- structures/locale/ko_KR/LC_MESSAGES/django.po,sha256=W1TxeBo3uPGllQ0yAdxp3a2ApTjFKUvukuqU5CFHzQ0,46297
46
- structures/locale/ru/LC_MESSAGES/django.mo,sha256=rScAxkkERgdEypFcQGq1srActGtSOnTJNhv2czipZag,54848
47
- structures/locale/ru/LC_MESSAGES/django.po,sha256=1_uMwJwJObAlIta62i6EbIZAwgd8iHSAToev2jmnEYU,74681
45
+ structures/locale/ko_KR/LC_MESSAGES/django.po,sha256=_fwBw1RWHfW8CKCNa6FTRJtL_P8cWjyta3ex3iuT14g,58737
46
+ structures/locale/ru/LC_MESSAGES/django.mo,sha256=eXLViTne15HyFtVusQAMcfBlxhHXs1X2VyhVNPCAqX0,70358
47
+ structures/locale/ru/LC_MESSAGES/django.po,sha256=z9y4LpWbtJIeD5zdlcdSqsssYyDpW0AeUjAadqxHgr8,95509
48
48
  structures/locale/uk/LC_MESSAGES/django.mo,sha256=WJ7UMXi2qaLIrpvAm-c-O78ZBcbnQfTzQAK0Xp1LIak,609
49
- structures/locale/uk/LC_MESSAGES/django.po,sha256=KdlLRb0W_q_WNm2MToyTZ_Z-Td9p2hsBjEATHGO6jNY,46515
49
+ structures/locale/uk/LC_MESSAGES/django.po,sha256=jFo9kej6b1zSu5_J3gCWeHl2PogX3wQKIAmwotKC6b4,58955
50
50
  structures/locale/zh_Hans/LC_MESSAGES/django.mo,sha256=hg7JkPlzTeMN2NIs99mR4_ZDVLYz9GgfyAfgsclbIng,3291
51
- structures/locale/zh_Hans/LC_MESSAGES/django.po,sha256=Z7xUPLFhKS8oKANK7LEXE7N7tU8Rz-p7GY7bN_AkSW0,47243
51
+ structures/locale/zh_Hans/LC_MESSAGES/django.po,sha256=5fRh8DobwOdnFj4c_trm8MDlsGMh1kPdKmxIQWYkIGY,59683
52
52
  structures/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  structures/management/commands/structures_load_eve.py,sha256=UIGjeOchZr5eM8LtRpRp6-328tphQ11uITfriCtXjzM,1507
54
54
  structures/management/commands/structures_preload_eveuniverse.py,sha256=oYf4OILhQmTodMGV_01b96aqouP5FmWmvbTxi9v0xa0,2489
@@ -117,7 +117,7 @@ structures/static/structures/img/panel/tyrannis_blue.png,sha256=79O2YMMnVsAi1cMW
117
117
  structures/static/structures/img/panel/tyrannis_darkred.png,sha256=CwCeqXvr6Nm-Kf7XKfLCHyEiwufJkTrkk-B6g57uCBg,42833
118
118
  structures/static/structures/img/panel/tyrannis_default.png,sha256=18TntkT7i0YZHZ-v9D_-glKHDKYEA0rSTjXMqwXFy0Q,38343
119
119
  structures/static/structures/img/panel/tyrannis_revelations.png,sha256=mnaL5lt-1D-Do7sb77QJDc3EPtoynz207Z932S09is0,42868
120
- structures/templates/structures/base.html,sha256=NXJP-b546wLQ3VYKtdwubzqBQ3mZ0BJGiLRtl31cBwQ,298
120
+ structures/templates/structures/base.html,sha256=KqUbI5pTp17tj97gjxZHjcsuZyNl1ggD1j9ra3Z447U,310
121
121
  structures/templates/structures/main.html,sha256=4sl71KGoAAtTywcJNvgdS7RpK15_XJ4JYuVpUC8nwT8,21200
122
122
  structures/templates/structures/modals/fitting_assets.html,sha256=0GSpDAk-wgvaZdxM9JzteUYhoPsek5y-L4TdG2q5Sbg,264
123
123
  structures/templates/structures/modals/fitting_gfx.html,sha256=hmdU1Zv09woGKigUugbBRxScKQun8l81yEPUMGrok2g,9530
@@ -185,7 +185,7 @@ structures/webhooks/models.py,sha256=RXLFMSnTyC7hYAoxhD3BmJivaQtVE0-pXd-BG_MdnBw
185
185
  structures/webhooks/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
186
186
  structures/webhooks/tests/test_core.py,sha256=gDW9o9wF20iqqX-u4notowfbxPSfFylJkngV5XkSOd0,6412
187
187
  structures/webhooks/tests/test_utils.py,sha256=ekADFv0JOEtXeqdiejbeqrABO__Q1flJHzVieQ7L9e0,459
188
- aa_structures-2.6.1.dist-info/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
189
- aa_structures-2.6.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
190
- aa_structures-2.6.1.dist-info/METADATA,sha256=E8VTFUW7AYtxB5uOdnSWAZdHsci-0LiDnxU2d9YavWo,5974
191
- aa_structures-2.6.1.dist-info/RECORD,,
188
+ aa_structures-2.6.2.dist-info/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
189
+ aa_structures-2.6.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
190
+ aa_structures-2.6.2.dist-info/METADATA,sha256=Z_44f0ru_pQaqrI7ANm9CuEtURNKiTJfZIXUFcIIFrU,5974
191
+ aa_structures-2.6.2.dist-info/RECORD,,
structures/__init__.py CHANGED
@@ -3,5 +3,5 @@
3
3
  # pylint: disable = invalid-name
4
4
  default_app_config = "structures.apps.StructuresConfig"
5
5
 
6
- __version__ = "2.6.1"
6
+ __version__ = "2.6.2"
7
7
  __title__ = "Structures"
@@ -12,6 +12,7 @@ from eveuniverse.models import EveType
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
@@ -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)[0]
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
  )
@@ -7,6 +7,7 @@ import dhooks_lite
7
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,12 +21,12 @@ 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"]
25
- )[0]
26
- self._corporation = EveEntity.objects.get_or_create_esi(
27
- id=self._parsed_text["corpID"]
28
- )[0]
24
+ self._character = get_or_create_esi_obj(
25
+ EveEntity, id=self._parsed_text["charID"]
26
+ )
27
+ self._corporation = get_or_create_esi_obj(
28
+ EveEntity, id=self._parsed_text["corpID"]
29
+ )
29
30
  self._character_link = gen_eve_entity_link(self._character)
30
31
  self._corporation_link = gen_corporation_link(self._corporation.name)
31
32
  self._application_text = self._parsed_text.get("applicationText", "")
@@ -14,7 +14,7 @@ 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
@@ -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])[0]
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:
@@ -11,6 +11,7 @@ from eveuniverse.models import EveEntity, EveType
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)[0]
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,9 +64,7 @@ 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
- )[0]
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
70
  self._title = _("Moon mining extraction started")
@@ -76,7 +75,7 @@ class NotificationMoonminningExtractionStarted(NotificationMoonminingEmbed):
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,
@@ -101,7 +100,7 @@ class NotificationMoonminningExtractionFinished(NotificationMoonminingEmbed):
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,
@@ -122,7 +121,7 @@ class NotificationMoonminningAutomaticFracture(NotificationMoonminingEmbed):
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,9 +136,9 @@ 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"]
142
- )[0]
139
+ cancelled_by = get_or_create_esi_obj(
140
+ EveEntity, id=self._parsed_text["cancelledBy"]
141
+ )
143
142
  else:
144
143
  cancelled_by = _("(unknown)")
145
144
  self._title = _("Extraction cancelled")
@@ -169,7 +168,7 @@ class NotificationMoonminningLaserFired(NotificationMoonminingEmbed):
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,
@@ -10,6 +10,7 @@ from eveuniverse.models import EveType
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,9 +27,9 @@ 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
31
- )[0]
30
+ self._structure_type = get_or_create_esi_obj(
31
+ EveType, id=EveTypeId.CUSTOMS_OFFICE
32
+ )
32
33
  self._solar_system_link = gen_solar_system_text(
33
34
  self._notification.eve_solar_system()
34
35
  )
@@ -95,12 +95,8 @@ class NotificationSovCommandNodeEventStarted(NotificationSovEmbed):
95
95
  class NotificationSovAllClaimAcquiredMsg(NotificationSovEmbed):
96
96
  def __init__(self, notification: Notification) -> None:
97
97
  super().__init__(notification)
98
- alliance = EveEntity.objects.get_or_create_esi(
99
- id=self._parsed_text["allianceID"]
100
- )[0]
101
- corporation = EveEntity.objects.get_or_create_esi(
102
- id=self._parsed_text["corpID"]
103
- )[0]
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"])
104
100
  self._title = (
105
101
  _("DED Sovereignty claim acknowledgment: %s") % self._solar_system.name
106
102
  )
@@ -119,12 +115,8 @@ class NotificationSovAllClaimAcquiredMsg(NotificationSovEmbed):
119
115
  class NotificationSovAllClaimLostMsg(NotificationSovEmbed):
120
116
  def __init__(self, notification: Notification) -> None:
121
117
  super().__init__(notification)
122
- alliance = EveEntity.objects.get_or_create_esi(
123
- id=self._parsed_text["allianceID"]
124
- )[0]
125
- corporation = EveEntity.objects.get_or_create_esi(
126
- id=self._parsed_text["corpID"]
127
- )[0]
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"])
128
120
  self._title = _("Lost sovereignty in: %s") % self._solar_system.name
129
121
  self._description = _(
130
122
  "DED acknowledges that member corporation %(corporation)s has lost its "
@@ -183,13 +175,13 @@ class NotificationSovStructureDestroyed(NotificationSovEmbed):
183
175
  class NotificationSovAllAnchoringMsg(NotificationBaseEmbed):
184
176
  def __init__(self, notification: Notification) -> None:
185
177
  super().__init__(notification)
186
- corporation = EveEntity.objects.get_or_create_esi(
187
- id=self._parsed_text.get("corpID")
188
- )[0]
178
+ corporation = get_or_create_esi_obj(
179
+ EveEntity, id=self._parsed_text.get("corpID")
180
+ )
189
181
  corp_link = gen_eve_entity_link(corporation)
190
182
  alliance_id = self._parsed_text.get("allianceID")
191
183
  if alliance_id:
192
- alliance = EveEntity.objects.get_or_create_esi(id=alliance_id)[0]
184
+ alliance = get_or_create_esi_obj(EveEntity, id=alliance_id)
193
185
  structure_owner = f"{corp_link} ({alliance.name})"
194
186
  else:
195
187
  structure_owner = corp_link
@@ -197,7 +189,7 @@ class NotificationSovAllAnchoringMsg(NotificationBaseEmbed):
197
189
  structure_type = self._notification.eve_structure_type("typeID")
198
190
  moon_id = self._parsed_text.get("moonID")
199
191
  if moon_id:
200
- eve_moon = EveMoon.objects.get_or_create_esi(id=moon_id)[0]
192
+ eve_moon = get_or_create_esi_obj(EveMoon, id=moon_id)
201
193
  location_text = _(" near **%s**") % eve_moon.name
202
194
  else:
203
195
  location_text = ""
@@ -47,19 +47,24 @@ class NotificationStructureEmbed(NotificationBaseEmbed):
47
47
  structure_type = structure.eve_type
48
48
  structure_solar_system = structure.eve_solar_system
49
49
  owner_link = gen_corporation_link(str(structure.owner))
50
- location = f" at {structure.eve_moon} " if structure.eve_moon else ""
50
+ # Translators: Context is a location, e.g. a moon
51
+ location = _(" at %s ") % structure.eve_moon if structure.eve_moon else ""
51
52
 
52
53
  self._structure = structure
53
- self._description = _(
54
- "The %(structure_type)s %(structure_name)s%(location)s in %(solar_system)s "
55
- "belonging to %(owner_link)s "
56
- ) % {
57
- "structure_type": structure_type.name,
58
- "structure_name": Webhook.text_bold(structure_name),
59
- "location": location,
60
- "solar_system": gen_solar_system_text(structure_solar_system),
61
- "owner_link": owner_link,
62
- }
54
+ self._description = (
55
+ _(
56
+ "The %(structure_type)s %(structure_name)s%(location)s "
57
+ "in %(solar_system)s belonging to %(owner_link)s"
58
+ )
59
+ % {
60
+ "structure_type": structure_type.name,
61
+ "structure_name": Webhook.text_bold(structure_name),
62
+ "location": location,
63
+ "solar_system": gen_solar_system_text(structure_solar_system),
64
+ "owner_link": owner_link,
65
+ }
66
+ + " "
67
+ )
63
68
  self._thumbnail = dhooks_lite.Thumbnail(
64
69
  structure_type.icon_url(size=self.ICON_DEFAULT_SIZE)
65
70
  )
@@ -97,11 +102,10 @@ class NotificationStructureJumpFuelAlert(NotificationStructureEmbed):
97
102
  self._description += _(
98
103
  "is below %(threshold)s units on Liquid Ozone.\n"
99
104
  "Remaining units: %(remaining)s."
100
- % {
101
- "threshold": f"{Webhook.text_bold(threshold_str)}",
102
- "remaining": f"{Webhook.text_bold(quantity_str)}",
103
- }
104
- )
105
+ ) % {
106
+ "threshold": f"{Webhook.text_bold(threshold_str)}",
107
+ "remaining": f"{Webhook.text_bold(quantity_str)}",
108
+ }
105
109
  self._color = Webhook.Color.WARNING
106
110
 
107
111
 
@@ -161,10 +165,10 @@ class NotificationStructureUnderAttack(NotificationStructureEmbed):
161
165
  def __init__(self, notification: Notification) -> None:
162
166
  super().__init__(notification)
163
167
  self._title = _("Structure under attack")
164
- self._description += _("is under attack by %s.\n%s") % (
165
- self._get_attacker_link(),
166
- self.compile_damage_text("Percentage"),
167
- )
168
+ self._description += _("is under attack by %(attacker)s.\n%(damage_text)s") % {
169
+ "attacker": self._get_attacker_link(),
170
+ "damage_text": self.compile_damage_text("Percentage"),
171
+ }
168
172
  self._color = Webhook.Color.DANGER
169
173
 
170
174
  def _get_attacker_link(self) -> str:
@@ -175,7 +179,7 @@ class NotificationStructureUnderAttack(NotificationStructureEmbed):
175
179
  if self._parsed_text.get("corpName"):
176
180
  return gen_corporation_link(self._parsed_text["corpName"])
177
181
 
178
- return "(unknown)"
182
+ return _("(unknown)")
179
183
 
180
184
 
181
185
  class NotificationStructureLostShield(NotificationStructureEmbed):
@@ -291,7 +295,7 @@ class NotificationStructureReinforceChange(NotificationBaseEmbed):
291
295
  id=structure_info[2]
292
296
  ),
293
297
  eve_solar_system=None,
294
- owner_link="(unknown)",
298
+ owner_link=_("(unknown)"),
295
299
  )
296
300
  )
297
301
  else:
@@ -322,6 +326,6 @@ class NotificationStructureReinforceChange(NotificationBaseEmbed):
322
326
  }
323
327
 
324
328
  self._description += _(
325
- "\n\nChange becomes effective at %s."
329
+ _("\n\nChange becomes effective at %s.")
326
330
  ) % target_datetime_formatted(change_effective)
327
331
  self._color = Webhook.Color.INFO
@@ -36,15 +36,21 @@ class NotificationTowerEmbed(NotificationBaseEmbed):
36
36
  self._thumbnail = dhooks_lite.Thumbnail(
37
37
  structure_type.icon_url(size=self.ICON_DEFAULT_SIZE)
38
38
  )
39
- self._description = _(
40
- "The starbase %(structure_name)s at %(moon)s "
41
- "in %(solar_system)s belonging to %(owner_link)s "
42
- ) % {
43
- "structure_name": Webhook.text_bold(structure_name),
44
- "moon": eve_moon.name,
45
- "solar_system": gen_solar_system_text(eve_moon.eve_planet.eve_solar_system),
46
- "owner_link": gen_corporation_link(str(notification.owner)),
47
- }
39
+ self._description = (
40
+ _(
41
+ "The starbase %(structure_name)s at %(moon)s "
42
+ "in %(solar_system)s belonging to %(owner_link)s"
43
+ )
44
+ % {
45
+ "structure_name": Webhook.text_bold(structure_name),
46
+ "moon": eve_moon.name,
47
+ "solar_system": gen_solar_system_text(
48
+ eve_moon.eve_planet.eve_solar_system
49
+ ),
50
+ "owner_link": gen_corporation_link(str(notification.owner)),
51
+ }
52
+ + " "
53
+ )
48
54
 
49
55
 
50
56
  class NotificationTowerAlertMsg(NotificationTowerEmbed):
@@ -138,7 +144,7 @@ class NotificationTowerReinforcedExtra(GeneratedNotificationTowerEmbed):
138
144
  dt.datetime.fromisoformat(notification.details["reinforced_until"])
139
145
  )
140
146
  except (KeyError, ValueError):
141
- reinforced_until = "(unknown)"
147
+ reinforced_until = _("(unknown)")
142
148
 
143
149
  self._description += (
144
150
  _("has been reinforced and will come out at: %s.") % reinforced_until