Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
2ae58b20
Kaydet (Commit)
2ae58b20
authored
Agu 14, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[py3] Fixed egg template loader.
üst
dcf72835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
eggs.py
django/template/loaders/eggs.py
+9
-4
No files found.
django/template/loaders/eggs.py
Dosyayı görüntüle @
2ae58b20
# Wrapper for loading templates from eggs via pkg_resources.resource_string.
from
__future__
import
unicode_literals
try
:
from
pkg_resources
import
resource_string
except
ImportError
:
resource_string
=
None
from
django.conf
import
settings
from
django.template.base
import
TemplateDoesNotExist
from
django.template.loader
import
BaseLoader
from
django.
conf
import
settings
from
django.
utils
import
six
class
Loader
(
BaseLoader
):
is_usable
=
resource_string
is
not
None
...
...
@@ -22,9 +24,12 @@ class Loader(BaseLoader):
pkg_name
=
'templates/'
+
template_name
for
app
in
settings
.
INSTALLED_APPS
:
try
:
return
(
resource_string
(
app
,
pkg_name
)
.
decode
(
settings
.
FILE_CHARSET
),
'egg:
%
s:
%
s'
%
(
app
,
pkg_name
))
except
:
pass
resource
=
resource_string
(
app
,
pkg_name
)
except
Exception
:
continue
if
not
six
.
PY3
:
resource
=
resource
.
decode
(
settings
.
FILE_CHARSET
)
return
(
resource
,
'egg:
%
s:
%
s'
%
(
app
,
pkg_name
))
raise
TemplateDoesNotExist
(
template_name
)
_loader
=
Loader
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment