##// END OF EJS Templates
chore(cleanups): use single consistent escape for descriptions
super-admin -
r5463:c1f0b110 default
parent child Browse files
Show More
@@ -128,6 +128,11 b' def _hash_key(k):'
128 return sha1_safe(k)
128 return sha1_safe(k)
129
129
130
130
131 def description_escaper(desc):
132 from rhodecode.lib import helpers as h
133 return h.html_escape(desc)
134
135
131 def in_filter_generator(qry, items, limit=500):
136 def in_filter_generator(qry, items, limit=500):
132 """
137 """
133 Splits IN() into multiple with OR
138 Splits IN() into multiple with OR
@@ -663,16 +668,14 b' class User(Base, BaseModel):'
663
668
664 @hybrid_property
669 @hybrid_property
665 def first_name(self):
670 def first_name(self):
666 from rhodecode.lib import helpers as h
667 if self.name:
671 if self.name:
668 return h.escape(self.name)
672 return description_escaper(self.name)
669 return self.name
673 return self.name
670
674
671 @hybrid_property
675 @hybrid_property
672 def last_name(self):
676 def last_name(self):
673 from rhodecode.lib import helpers as h
674 if self.lastname:
677 if self.lastname:
675 return h.escape(self.lastname)
678 return description_escaper(self.lastname)
676 return self.lastname
679 return self.lastname
677
680
678 @hybrid_property
681 @hybrid_property
@@ -1368,8 +1371,7 b' class UserApiKeys(Base, BaseModel):'
1368
1371
1369 @hybrid_property
1372 @hybrid_property
1370 def description_safe(self):
1373 def description_safe(self):
1371 from rhodecode.lib import helpers as h
1374 return description_escaper(self.description)
1372 return h.escape(self.description)
1373
1375
1374 @property
1376 @property
1375 def expired(self):
1377 def expired(self):
@@ -1472,8 +1474,7 b' class UserIpMap(Base, BaseModel):'
1472
1474
1473 @hybrid_property
1475 @hybrid_property
1474 def description_safe(self):
1476 def description_safe(self):
1475 from rhodecode.lib import helpers as h
1477 return description_escaper(self.description)
1476 return h.escape(self.description)
1477
1478
1478 @classmethod
1479 @classmethod
1479 def _get_ip_range(cls, ip_addr):
1480 def _get_ip_range(cls, ip_addr):
@@ -1611,8 +1612,7 b' class UserGroup(Base, BaseModel):'
1611
1612
1612 @hybrid_property
1613 @hybrid_property
1613 def description_safe(self):
1614 def description_safe(self):
1614 from rhodecode.lib import helpers as h
1615 return description_escaper(self.user_group_description)
1615 return h.escape(self.user_group_description)
1616
1616
1617 @hybrid_property
1617 @hybrid_property
1618 def group_data(self):
1618 def group_data(self):
@@ -1956,8 +1956,7 b' class Repository(Base, BaseModel):'
1956
1956
1957 @hybrid_property
1957 @hybrid_property
1958 def description_safe(self):
1958 def description_safe(self):
1959 from rhodecode.lib import helpers as h
1959 return description_escaper(self.description)
1960 return h.escape(self.description)
1961
1960
1962 @hybrid_property
1961 @hybrid_property
1963 def landing_rev(self):
1962 def landing_rev(self):
@@ -2915,8 +2914,7 b' class RepoGroup(Base, BaseModel):'
2915
2914
2916 @hybrid_property
2915 @hybrid_property
2917 def description_safe(self):
2916 def description_safe(self):
2918 from rhodecode.lib import helpers as h
2917 return description_escaper(self.group_description)
2919 return h.escape(self.group_description)
2920
2918
2921 @classmethod
2919 @classmethod
2922 def hash_repo_group_name(cls, repo_group_name):
2920 def hash_repo_group_name(cls, repo_group_name):
@@ -4418,8 +4416,7 b' class _PullRequestBase(BaseModel):'
4418
4416
4419 @hybrid_property
4417 @hybrid_property
4420 def description_safe(self):
4418 def description_safe(self):
4421 from rhodecode.lib import helpers as h
4419 return description_escaper(self.description)
4422 return h.escape(self.description)
4423
4420
4424 @hybrid_property
4421 @hybrid_property
4425 def revisions(self):
4422 def revisions(self):
@@ -5027,8 +5024,7 b' class Gist(Base, BaseModel):'
5027
5024
5028 @hybrid_property
5025 @hybrid_property
5029 def description_safe(self):
5026 def description_safe(self):
5030 from rhodecode.lib import helpers as h
5027 return description_escaper(self.gist_description)
5031 return h.escape(self.gist_description)
5032
5028
5033 @classmethod
5029 @classmethod
5034 def get_or_404(cls, id_):
5030 def get_or_404(cls, id_):
General Comments 0
You need to be logged in to leave comments. Login now