Nachádzate sa tu
Pages that link to 22 cez rok 2018
Primárne karty
No backlinks found.
Kontakty
Rímskokatolícka cirkev
Farnosť Častá
Andreja Hlinku 1
900 89 Častá
tel.: +421 33 6495 225
e-mail: farnostcasta@gmail.com
Kalendár
# -*- coding: utf-8 -*-
# Copyright (c) 2012, Pavol Otto
# Released under BSD license ( http://www.opensource.org/licenses/bsd-license.php )
import os, sys, re
from mod_python import util
from datetime import timedelta
from cgi import escape
sys.path.append( os.path.join( os.path.split( __file__)[ 0], "litcal"))
from litcalendar import litcalendar
linkreplace = re.compile( "(?<=)")
liturgia_link = "%s"
format_xml_cell = """
%s %s
"""
format_xml = """
%d
%d
%d
%s
%s
%s
%s
"""
format_httag = """
Liturgický kalendár
"""
def linkedit( s):
return linkreplace.sub( r"https://www.zivotopisysvatych.sk/\g<0>/", s)
def xml_cell( den):
st_list = "\t\t\t" + linkedit( den[ 'standarddnes'] or den[ 'dnes']) + " \n"
if den[ 'standarddnes'] and den[ 'standarddnes'] != den[ 'dnes']:
lit = den[ 'dnes'] + " (" + den[ 'liturgia'] + ( den[ 'priksv'] and ", prikázaný sviatok" or "") + ")"
else:
lit = den[ 'liturgia'] + ( den[ 'priksv'] and ", prikázaný sviatok" or "")
return format_xml_cell % ( den[ 'isodat'], st_list, den[ 'priksv'] and " prikazanysviatok=\"True\"" or "", lit)
def to_XML( den, days_fwd = 0):
# days_fwd - pocet dni dopredu, kolko zobrazit
dni = xml_cell( den)
for x in range( 1, days_fwd + 1):
dni += xml_cell( den + timedelta( x))
meniny = den[ "meniny"] and ( ">" + escape( den[ "meniny"]) + "" + escape( den[ "pamden"]) + "" + escape( den[ "meniny"]) + "."
else:
meniny = ""
if pamatnedni:
if den[ "pamden"]:
if meniny:
meniny += "\n\t
Dnešný dátum: %s
%s
Katolícky kalendár:
"""
# len dnesok
httag_dnes = """%s
- liturgia: %s
"""
# dnesok aj zajtrajsok
httag_dn_zajtra = """Dnes: %s
- liturgia: %s
Zajtra: %s
- liturgia: %s
"""
format_html = """
"
meniny += "Dnes je " + den[ "pamden"] + "."
elif not meniny:
meniny += "Dnes je " + den[ "pamden"] + "."
dneslit = liturgia_link % ( den[ "liturgia"] + ( den[ 'priksv'] and ", prikázaný sviatok" or ""), )
if den[ 'standarddnes'] and den[ 'standarddnes'] != den[ 'dnes']:
dneslit = den[ 'dnes'] + " (" + dneslit + ")"
contparam = [ linkedit( den[ 'standarddnes'] or den[ 'dnes']), dneslit]
if tomorrow:
zajtra = den + timedelta( 1)
zajtralit = liturgia_link % ( zajtra[ "liturgia"] + ( zajtra[ 'priksv'] and ", prikázaný sviatok" or ""), )
if zajtra[ 'standarddnes'] and zajtra[ 'standarddnes'] != zajtra[ 'dnes']:
zajtralit = zajtra[ 'dnes'] + " (" + zajtralit + ")"
contparam += [ linkedit( zajtra[ 'standarddnes'] or zajtra[ 'dnes']), zajtralit]
return format_httag % ( escape( den[ 'weekday']) + ", " + escape( den[ shortform and "numdat" or "textdat"]), meniny) + ( tomorrow and ( httag_dn_zajtra % tuple( contparam)) or ( httag_dnes % tuple( contparam))) + "\n\t
\n" % ( den[ "litrok"], )
def index( req):
urlparams = util.FieldStorage( req)
rok = urlparams.getfirst( "rok")
mesiac = urlparams.getfirst( "mesiac")
den = urlparams.getfirst( "den")
form = urlparams.getfirst( "format")
daysfwd = urlparams.getfirst( "dopredu")
pamdni = urlparams.getfirst( "pamdni")
if type( rok) is util.StringField and rok.isdigit():
rok = int( rok)
else:
rok = None
if type( mesiac) is util.StringField and mesiac.isdigit():
mesiac = int( mesiac)
else:
meisac = None
if type( den) is util.StringField and den.isdigit():
den = int( den)
else:
den = None
if type( form) is util.StringField:
form = form.upper()
if form not in ( "XML", "HTML", "HTTAG"):
form = "HTML"
if type( daysfwd) is util.StringField and daysfwd.isdigit():
daysfwd = int( daysfwd)
else:
daysfwd = 1
if pamdni in ( "0", "nie"):
pamdni = False
else:
pamdni = True
try:
today = litcalendar( rok, mesiac, den)
except Exception, e:
today = litcalendar()
if form == "HTTAG":
req.content_type = "text/html; charset=utf-8"
return to_HTTAG( today, pamdni, daysfwd)
elif form == "HTML":
# o req.content_type sa stara publisher
return format_html + to_HTTAG( today, pamdni, daysfwd) + " \n"
else:
# format == "XML"
req.content_type = "text/xml; charset=utf-8"
return to_XML( today, daysfwd)
Liturgický rok: %s
\nCopyright © 2024, Rímskokatolícka cirkev - farnosť sv. Imricha Častá
:: prihlasenie