##// END OF EJS Templates
emails: use more consistent output between commits email and pull request email.
emails: use more consistent output between commits email and pull request email.

File last commit:

r523:878882bd default
r535:477f97a4 default
Show More
types.py
34 lines | 1.3 KiB | text/x-python | PythonLexer
gists: use colander schema to validate input data....
r523 # -*- coding: utf-8 -*-
# Copyright (C) 2016-2016 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import colander
class GroupNameType(colander.String):
SEPARATOR = '/'
def deserialize(self, node, cstruct):
result = super(GroupNameType, self).deserialize(node, cstruct)
return self._replace_extra_slashes(result)
def _replace_extra_slashes(self, path):
path = path.split(self.SEPARATOR)
path = [item for item in path if item]
return self.SEPARATOR.join(path)