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
9f9a4cde
Kaydet (Commit)
9f9a4cde
authored
Ara 24, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed truncate_words and truncate_html_words.
üst
e00d1b6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
40 deletions
+0
-40
text.py
django/utils/text.py
+0
-14
text.py
tests/regressiontests/utils/text.py
+0
-26
No files found.
django/utils/text.py
Dosyayı görüntüle @
9f9a4cde
...
...
@@ -209,20 +209,6 @@ class Truncator(SimpleLazyObject):
# Return string
return
out
def
truncate_words
(
s
,
num
,
end_text
=
'...'
):
warnings
.
warn
(
'This function has been deprecated. Use the Truncator class '
'in django.utils.text instead.'
,
category
=
DeprecationWarning
)
truncate
=
end_text
and
'
%
s'
%
end_text
or
''
return
Truncator
(
s
)
.
words
(
num
,
truncate
=
truncate
)
truncate_words
=
allow_lazy
(
truncate_words
,
six
.
text_type
)
def
truncate_html_words
(
s
,
num
,
end_text
=
'...'
):
warnings
.
warn
(
'This function has been deprecated. Use the Truncator class '
'in django.utils.text instead.'
,
category
=
DeprecationWarning
)
truncate
=
end_text
and
'
%
s'
%
end_text
or
''
return
Truncator
(
s
)
.
words
(
num
,
truncate
=
truncate
,
html
=
True
)
truncate_html_words
=
allow_lazy
(
truncate_html_words
,
six
.
text_type
)
def
get_valid_filename
(
s
):
"""
Returns the given string converted to a string that can be used for a clean
...
...
tests/regressiontests/utils/text.py
Dosyayı görüntüle @
9f9a4cde
...
...
@@ -8,8 +8,6 @@ from django.utils import text
class
TestUtilsText
(
SimpleTestCase
):
# In Django 1.6 truncate_words() and truncate_html_words() will be removed
# so these tests will need to be adapted accordingly
def
test_truncate_chars
(
self
):
truncator
=
text
.
Truncator
(
'The quick brown fox jumped over the lazy dog.'
...
...
@@ -73,30 +71,6 @@ class TestUtilsText(SimpleTestCase):
self
.
assertEqual
(
'<p>The quick <a href="xyz.html"
\n
'
'id="mylink">brown...</a></p>'
,
truncator
.
words
(
3
,
'...'
,
html
=
True
))
def
test_old_truncate_words
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
"always"
)
self
.
assertEqual
(
'The quick brown fox jumped over the lazy dog.'
,
text
.
truncate_words
(
'The quick brown fox jumped over the lazy dog.'
,
10
))
self
.
assertEqual
(
'The quick brown fox ...'
,
text
.
truncate_words
(
'The quick brown fox jumped over the lazy dog.'
,
4
))
self
.
assertEqual
(
'The quick brown fox ....'
,
text
.
truncate_words
(
'The quick brown fox jumped over the lazy dog.'
,
4
,
'....'
))
self
.
assertGreater
(
len
(
w
),
0
)
def
test_old_truncate_html_words
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
"always"
)
self
.
assertEqual
(
'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>'
,
text
.
truncate_html_words
(
'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>'
,
10
))
self
.
assertEqual
(
'<p><strong><em>The quick brown fox ...</em></strong></p>'
,
text
.
truncate_html_words
(
'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>'
,
4
))
self
.
assertEqual
(
'<p><strong><em>The quick brown fox ....</em></strong></p>'
,
text
.
truncate_html_words
(
'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>'
,
4
,
'....'
))
self
.
assertEqual
(
'<p><strong><em>The quick brown fox</em></strong></p>'
,
text
.
truncate_html_words
(
'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>'
,
4
,
None
))
self
.
assertGreater
(
len
(
w
),
0
)
def
test_wrap
(
self
):
digits
=
'1234 67 9'
self
.
assertEqual
(
text
.
wrap
(
digits
,
100
),
'1234 67 9'
)
...
...
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