fixes & typing
This commit is contained in:
parent
d9cac7b1d3
commit
95ccc5fab5
@ -1,4 +1,5 @@
|
|||||||
# pyright: basic
|
# pyright: basic
|
||||||
|
# type: ignore
|
||||||
from peewee import (
|
from peewee import (
|
||||||
SQL,
|
SQL,
|
||||||
BigAutoField,
|
BigAutoField,
|
||||||
|
@ -30,7 +30,7 @@ class Item:
|
|||||||
self.sector_id: int = item.id_secteur
|
self.sector_id: int = item.id_secteur
|
||||||
self.update: str = item.maj
|
self.update: str = item.maj
|
||||||
self.lang: str = item.lang
|
self.lang: str = item.lang
|
||||||
self.set_lang: bool = item.langue_choisie # TODO Why ?
|
self.set_lang: bool = item.langue_choisie == "oui" # TODO Why ?
|
||||||
self.translation_key: int = item.id_trad
|
self.translation_key: int = item.id_trad
|
||||||
self.extra: str = convert_body(item.extra) # Probably unused
|
self.extra: str = convert_body(item.extra) # Probably unused
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class Article(Item):
|
|||||||
self.ps: str = convert_body(article.ps) # Probably unused
|
self.ps: str = convert_body(article.ps) # Probably unused
|
||||||
self.update_2: str = article.date_modif # Probably unused duplicate of maj
|
self.update_2: str = article.date_modif # Probably unused duplicate of maj
|
||||||
self.creation: str = article.date_redac
|
self.creation: str = article.date_redac
|
||||||
self.forum: bool = article.accepter_forum # TODO Why ?
|
self.forum: bool = article.accepter_forum == "oui" # TODO Why ?
|
||||||
self.sitename: str = article.nom_site # Probably useless
|
self.sitename: str = article.nom_site # Probably useless
|
||||||
self.virtual: str = article.virtuel # TODO Why ?
|
self.virtual: str = article.virtuel # TODO Why ?
|
||||||
self.microblog: str = article.microblog # Probably unused
|
self.microblog: str = article.microblog # Probably unused
|
||||||
@ -162,10 +162,10 @@ class Document:
|
|||||||
self.date: str = document.date
|
self.date: str = document.date
|
||||||
self.description: str = document.descriptif
|
self.description: str = document.descriptif
|
||||||
self.file: str = document.fichier
|
self.file: str = document.fichier
|
||||||
self.draft: bool = item.statut == "publie"
|
self.draft: bool = document.statut == "publie"
|
||||||
self.creation: str = item.date
|
self.creation: str = document.date
|
||||||
self.publication: str = item.date_publication
|
self.publication: str = document.date_publication
|
||||||
self.update: str = item.maj
|
self.update: str = document.maj
|
||||||
|
|
||||||
def get_slug(self, date: bool = False) -> str:
|
def get_slug(self, date: bool = False) -> str:
|
||||||
return slugify((self.publication + "-" if date else "") + self.title)
|
return slugify((self.publication + "-" if date else "") + self.title)
|
||||||
@ -246,6 +246,7 @@ class Documents(Iterator):
|
|||||||
SpipDocumentsLiens,
|
SpipDocumentsLiens,
|
||||||
on=(SpipDocuments.id_document == SpipDocumentsLiens.id_document),
|
on=(SpipDocuments.id_document == SpipDocumentsLiens.id_document),
|
||||||
)
|
)
|
||||||
|
.where(SpipDocumentsLiens.id_objet == object_id)
|
||||||
.order_by(SpipArticles.date.desc())
|
.order_by(SpipArticles.date.desc())
|
||||||
)
|
)
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
Loading…
Reference in New Issue
Block a user