<commit_before># This file is part of the GOsa framework.
#
#  http://gosa-project.org
#
# Copyright:
#  (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.

import os.path
from gosa.common import Environment
from gosa.backend.objects.renderer import ResultRenderer


class UserPhotoRenderer(ResultRenderer):

    @staticmethod
    def getName():
        return "userPhotoRenderer"

    @staticmethod
    def render(data):
        env = Environment.getInstance()

        cache_path = env.config.get('user.image-path', default="/var/lib/gosa/images")

        if os.path.exists(os.path.join(cache_path, data['_uuid'], "jpegPhoto", "0", "64.jpg")):
            return "/images/%s/jpegPhoto/0/64.jpg?c=%s" % (data['_uuid'], data["_last_changed"])

        return "/static/default/resources/images/objects/64/user.png"<commit_msg>Change one fixed path<commit_after># This file is part of the GOsa framework.
#
#  http://gosa-project.org
#
# Copyright:
#  (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.

import os.path
from gosa.common import Environment
from gosa.backend.objects.renderer import ResultRenderer


class UserPhotoRenderer(ResultRenderer):

    @staticmethod
    def getName():
        return "userPhotoRenderer"

    @staticmethod
    def render(data):
        env = Environment.getInstance()

        cache_path = env.config.get('user.image-path', default="/var/lib/gosa/images")

        if os.path.exists(os.path.join(cache_path, data['_uuid'], "jpegPhoto", "0", "64.jpg")):
            return "/images/%s/jpegPhoto/0/64.jpg?c=%s" % (data['_uuid'], data["_last_changed"])

        return "/static/resources/images/objects/64/user.png"
{'fraction_non_alphanumeric': 0.13993362831858408, 'fraction_numerical': 0.01327433628318584, 'mean_word_length': 3.579746835443038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6339393', 'n_tokens_mistral': 594, 'n_tokens_neox': 559, 'n_words': 132}