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
259cd3cd
Kaydet (Commit)
259cd3cd
authored
Ara 13, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Deprecated get_app_package, get_app_path and get_app_paths.
üst
da36d03f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
40 deletions
+52
-40
cache.py
django/apps/cache.py
+43
-30
loaddata.py
django/core/management/commands/loaddata.py
+2
-2
sql.py
django/core/management/sql.py
+1
-1
loader.py
django/db/migrations/loader.py
+1
-1
writer.py
django/db/migrations/writer.py
+3
-5
deprecation.txt
docs/internals/deprecation.txt
+2
-1
No files found.
django/apps/cache.py
Dosyayı görüntüle @
259cd3cd
...
...
@@ -5,6 +5,7 @@ import imp
from
importlib
import
import_module
import
os
import
sys
import
warnings
from
django.conf
import
settings
from
django.core.exceptions
import
ImproperlyConfigured
...
...
@@ -194,36 +195,6 @@ class BaseAppCache(object):
"""
return
[
app_config
.
models_module
for
app_config
in
self
.
get_app_configs
()]
def
_get_app_package
(
self
,
app
):
return
'.'
.
join
(
app
.
__name__
.
split
(
'.'
)[:
-
1
])
def
get_app_package
(
self
,
app_label
):
return
self
.
_get_app_package
(
self
.
get_app
(
app_label
))
def
_get_app_path
(
self
,
app
):
if
hasattr
(
app
,
'__path__'
):
# models/__init__.py package
app_path
=
app
.
__path__
[
0
]
else
:
# models.py module
app_path
=
app
.
__file__
return
os
.
path
.
dirname
(
upath
(
app_path
))
def
get_app_path
(
self
,
app_label
):
return
self
.
_get_app_path
(
self
.
get_app
(
app_label
))
def
get_app_paths
(
self
):
"""
Returns a list of paths to all installed apps.
Useful for discovering files at conventional locations inside apps
(static files, templates, etc.)
"""
self
.
_populate
()
app_paths
=
[]
for
app
in
self
.
get_apps
():
app_paths
.
append
(
self
.
_get_app_path
(
app
))
return
app_paths
def
get_app
(
self
,
app_label
):
"""
Returns the module containing the models for the given app_label.
...
...
@@ -363,6 +334,48 @@ class BaseAppCache(object):
def
unset_available_apps
(
self
):
self
.
available_apps
=
None
### DEPRECATED METHODS GO BELOW THIS LINE ###
def
_get_app_package
(
self
,
app
):
return
'.'
.
join
(
app
.
__name__
.
split
(
'.'
)[:
-
1
])
def
get_app_package
(
self
,
app_label
):
warnings
.
warn
(
"get_app_config(label).name supersedes get_app_package(label)."
,
PendingDeprecationWarning
,
stacklevel
=
2
)
return
self
.
_get_app_package
(
self
.
get_app
(
app_label
))
def
_get_app_path
(
self
,
app
):
if
hasattr
(
app
,
'__path__'
):
# models/__init__.py package
app_path
=
app
.
__path__
[
0
]
else
:
# models.py module
app_path
=
app
.
__file__
return
os
.
path
.
dirname
(
upath
(
app_path
))
def
get_app_path
(
self
,
app_label
):
warnings
.
warn
(
"get_app_config(label).path supersedes get_app_path(label)."
,
PendingDeprecationWarning
,
stacklevel
=
2
)
return
self
.
_get_app_path
(
self
.
get_app
(
app_label
))
def
get_app_paths
(
self
):
"""
Returns a list of paths to all installed apps.
Useful for discovering files at conventional locations inside apps
(static files, templates, etc.)
"""
warnings
.
warn
(
"[a.path for a in get_app_configs()] supersedes get_app_paths()."
,
PendingDeprecationWarning
,
stacklevel
=
2
)
self
.
_populate
()
app_paths
=
[]
for
app
in
self
.
get_apps
():
app_paths
.
append
(
self
.
_get_app_path
(
app
))
return
app_paths
class
AppCache
(
BaseAppCache
):
"""
...
...
django/core/management/commands/loaddata.py
Dosyayı görüntüle @
259cd3cd
...
...
@@ -230,8 +230,8 @@ class Command(BaseCommand):
current directory.
"""
dirs
=
[]
for
path
in
app_cache
.
get_app_path
s
():
d
=
os
.
path
.
join
(
path
,
'fixtures'
)
for
app_config
in
app_cache
.
get_app_config
s
():
d
=
os
.
path
.
join
(
app_config
.
path
,
'fixtures'
)
if
os
.
path
.
isdir
(
d
):
dirs
.
append
(
d
)
dirs
.
extend
(
list
(
settings
.
FIXTURE_DIRS
))
...
...
django/core/management/sql.py
Dosyayı görüntüle @
259cd3cd
...
...
@@ -169,7 +169,7 @@ def _split_statements(content):
def
custom_sql_for_model
(
model
,
style
,
connection
):
opts
=
model
.
_meta
app_dirs
=
[]
app_dir
=
app_cache
.
get_app_
path
(
model
.
_meta
.
app_label
)
app_dir
=
app_cache
.
get_app_
config
(
model
.
_meta
.
app_label
)
.
path
app_dirs
.
append
(
os
.
path
.
normpath
(
os
.
path
.
join
(
app_dir
,
'sql'
)))
# Deprecated location -- remove in Django 1.9
...
...
django/db/migrations/loader.py
Dosyayı görüntüle @
259cd3cd
...
...
@@ -46,7 +46,7 @@ class MigrationLoader(object):
if
app_label
in
settings
.
MIGRATION_MODULES
:
return
settings
.
MIGRATION_MODULES
[
app_label
]
else
:
return
'
%
s.migrations'
%
app_cache
.
get_app_
package
(
app_label
)
return
'
%
s.migrations'
%
app_cache
.
get_app_
config
(
app_label
)
.
name
def
load_disk
(
self
):
"""
...
...
django/db/migrations/writer.py
Dosyayı görüntüle @
259cd3cd
...
...
@@ -69,14 +69,12 @@ class MigrationWriter(object):
migrations_module
=
import_module
(
migrations_package_name
)
basedir
=
os
.
path
.
dirname
(
migrations_module
.
__file__
)
except
ImportError
:
app
=
app_cache
.
get_app
(
self
.
migration
.
app_label
)
app_path
=
app_cache
.
_get_app_path
(
app
)
app_package_name
=
app_cache
.
_get_app_package
(
app
)
app_config
=
app_cache
.
get_app_config
(
self
.
migration
.
app_label
)
migrations_package_basename
=
migrations_package_name
.
split
(
"."
)[
-
1
]
# Alright, see if it's a direct submodule of the app
if
'
%
s.
%
s'
%
(
app_
package_
name
,
migrations_package_basename
)
==
migrations_package_name
:
basedir
=
os
.
path
.
join
(
app_path
,
migrations_package_basename
)
if
'
%
s.
%
s'
%
(
app_
config
.
name
,
migrations_package_basename
)
==
migrations_package_name
:
basedir
=
os
.
path
.
join
(
app_
config
.
path
,
migrations_package_basename
)
else
:
raise
ImportError
(
"Cannot open migrations module
%
s for app
%
s"
%
(
migrations_package_name
,
self
.
migration
.
app_label
))
return
os
.
path
.
join
(
basedir
,
self
.
filename
)
...
...
docs/internals/deprecation.txt
Dosyayı görüntüle @
259cd3cd
...
...
@@ -223,7 +223,8 @@ these changes.
to :setting:`CACHES` and use :data:`django.core.cache.caches` instead.
* ``django.db.models.loading`` will be removed. Use the new application
loading APIs instead.
loading APIs instead. Several undocumented methods of the ``AppCache`` class
will also be removed.
2.0
---
...
...
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