Пример #1
0
    def data(self):
        psalms_60 = self.office_readings.mp_psalms.split("or")
        if len(psalms_60) > 1:
            if (self.date.date.year % 2) == 0:
                psalms_60 = psalms_60[0]
            else:
                psalms_60 = psalms_60[1]
        else:
            psalms_60 = psalms_60[0]

        citations_60 = psalms_60.split(",")

        psalms_30 = self.thirty_day_psalter_day.mp_psalms
        citations_30 = psalms_30.split(",")

        mass_psalm = ""
        mass_heading = ""
        for reading in self.date.mass_readings:
            if reading.reading_type == "psalm":
                mass_psalm = reading.long_text
                mass_heading = "The Psalm Appointed"
                break

        return {
            "citations_60":
            citations_60,
            "citations_30":
            citations_30,
            "heading_60":
            "The Psalm{} Appointed".format(
                "s" if len(citations_60) > 1 else ""),
            "psalms_60":
            get_psalms(psalms_60),
            "heading_30":
            "The Psalm{} Appointed".format(
                "s" if len(citations_30) > 1 else ""),
            "psalms_30":
            get_psalms(psalms_30),
            "psalms_mass":
            mass_psalm,
            "heading_mass":
            mass_heading,
            "daily_office_tag":
            "daily-office-readings-{}".format(
                "sunday"
                if self.date.primary.rank.precedence_rank <= 4 else "feria"),
            "mass_tag":
            "mass-readings-{}".format("sunday" if self.date.primary.rank.
                                      precedence_rank <= 4 else "feria"),
        }
Пример #2
0
    def get_passage(self, book, passage, reading_type):

        if book == "Canticle":
            canticle = self.get_canticle_class(passage)
            return "<h3>{}</h3><h4>{}</h4>{}<h5>{}</h5>".format(
                canticle.latin_name, canticle.english_name,
                canticle().content, canticle.citation)

        if reading_type == "psalm":
            passage = passage.replace("Psalms ", "")
            psalm = parse_single_psalm(passage)
            return get_psalms(psalm)

        passage = "{} {}".format(book, passage)

        if book == "Ps":
            return passage.replace("Ps", "Psalms")
        references = scriptures.extract(passage)

        passages = []
        for reference in references:
            passage = scriptures.reference_to_string(*reference)
            try:
                passages.append(Passage(passage, source="esv").html)
            except PassageNotFoundException:
                try:
                    passages.append(Passage(passage, source="rsv").html)
                except PassageNotFoundException:
                    pass

        return "<br>".join(passages)
Пример #3
0
def psalm(request, number):
    psalm_text = get_psalms(number)
    psalm = Psalm.objects.prefetch_related(
        Prefetch("psalmtopicpsalm_set__psalm_topic",
                 queryset=PsalmTopic.objects.order_by("order").all())).get(
                     number=number)
    topics = (PsalmTopic.objects.prefetch_related(
        Prefetch(
            "psalmtopicpsalm_set",
            queryset=PsalmTopicPsalm.objects.select_related("psalm").order_by(
                "order").all())).filter(psalmtopicpsalm__psalm=psalm).order_by(
                    "order").distinct().all())
    return render(
        request, "office/psalm.html", {
            "number": number,
            "psalm": psalm,
            "psalm_text": psalm_text,
            "topics": topics
        })
Пример #4
0
 def data(self):
     return {"heading": "The Psalm", "psalms": get_psalms("134")}
Пример #5
0
 def data(self):
     return {"heading": "The Psalm", "psalms": get_psalms("51:10-12")}
Пример #6
0
 def data(self):
     return {
         "heading": "The Psalms",
         "psalms": get_psalms("119:105-112,121,124,126")
     }
Пример #7
0
 def data(self):
     return {
         "heading": "The Psalms",
         "psalms": get_psalms("4,31:1-6,91,134")
     }