当前位置: 首页>>代码示例>>Python>>正文


Python translation.ugettext_noop方法代码示例

本文整理汇总了Python中django.utils.translation.ugettext_noop方法的典型用法代码示例。如果您正苦于以下问题:Python translation.ugettext_noop方法的具体用法?Python translation.ugettext_noop怎么用?Python translation.ugettext_noop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.utils.translation的用法示例。


在下文中一共展示了translation.ugettext_noop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_context_data

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def get_context_data(self, **kwargs):
        self.secondary_nav_items = copy.deepcopy(self.secondary_nav_items_base)
        if switch_is_active('enable_performance_learning_outcome'):
            if not any(d['name'] == 'learning_outcomes' for d in self.secondary_nav_items):
                self.secondary_nav_items.append({
                    'name': 'learning_outcomes',
                    'text': ugettext_noop('Learning Outcomes'),
                    'view': 'courses:performance:learning_outcomes',
                    'scope': 'course',
                    'lens': 'performance',
                    'report': 'outcomes',
                    'depth': ''
                })
                translate_dict_values(self.secondary_nav_items, ('text',))

        context_data = super(PerformanceTemplateView, self).get_context_data(**kwargs)
        self.presenter = CoursePerformancePresenter(self.access_token, self.course_id)

        context_data['no_data_message'] = self.no_data_message
        context_data['js_data']['course'].update({
            'contentTableHeading': _('Assignment Name')  # overwrite for different heading
        })

        return context_data 
开发者ID:edx,项目名称:edx-analytics-dashboard,代码行数:26,代码来源:performance.py

示例2: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self):
        node, dcnode = self.node, self.dcnode

        if dcnode.dc.vm_set.filter(node=node).exists():
            raise PreconditionRequired(_('Node has VMs in datacenter'))

        if dcnode.dc.backup_set.filter(node=node).exists():
            raise PreconditionRequired(_('Node has VM backups in datacenter'))

        ser = DcNodeSerializer(self.request, dcnode)
        ser.object.delete()
        DcNode.update_all(node=node)
        # noinspection PyStatementEffect
        ser.data

        return SuccessTaskResponse(self.request, None, obj=node, detail_dict=ser.detail_dict(), msg=LOG_NODE_DETACH) 
开发者ID:erigones,项目名称:esdc-ce,代码行数:18,代码来源:api_views.py

示例3: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self, ns):
        """Update node-storage"""
        ser = NodeStorageSerializer(self.request, ns)
        node = ns.node

        for vm in node.vm_set.all():
            if ns.zpool in vm.get_used_disk_pools():  # active + current
                raise PreconditionRequired(_('Storage is used by some VMs'))

        if node.is_backup:
            if ns.backup_set.exists():
                raise PreconditionRequired(_('Storage is used by some VM backups'))

        obj = ns.log_list
        owner = ns.storage.owner
        ser.object.delete()  # Will delete Storage in post_delete

        return SuccessTaskResponse(self.request, None, obj=obj, owner=owner, msg=LOG_NS_DELETE, dc_bound=False) 
开发者ID:erigones,项目名称:esdc-ce,代码行数:20,代码来源:api_views.py

示例4: safe_summary

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def safe_summary(self, encoded):
        algorithm, iterations, salt, hash = encoded.split('$', 3)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('iterations'), iterations),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(hash)),
        ]) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:11,代码来源:hashers.py

示例5: __str__

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def __str__(self):
        return _noop(
            'Message received from: {name}\n'
            'User email: {email}\n\n'
            '{message}'
        ).format(
            name=self.name,
            email=self.email,
            message=self.message
        ) 
开发者ID:eventoL,项目名称:eventoL,代码行数:12,代码来源:models.py

示例6: harden_runtime

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def harden_runtime(self, password, encoded):
        _, data = encoded.split('$', 1)
        salt = data[:29]  # Length of the salt in bcrypt.
        rounds = data.split('$')[2]
        # work factor is logarithmic, adding one doubles the load.
        diff = 2**(self.rounds - int(rounds)) - 1
        while diff > 0:
            self.encode(password, force_bytes(salt))
            diff -= 1 
开发者ID:bpgc-cte,项目名称:python2017,代码行数:11,代码来源:hashers.py

示例7: safe_summary

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def safe_summary(self, encoded):
        from django.contrib.auth.hashers import mask_hash
        from django.utils.translation import ugettext_noop as _
        handler = self.passlib_handler
        items = [
            # since this is user-facing, we're reporting passlib's name,
            # without the distracting PASSLIB_HASHER_PREFIX prepended.
            (_('algorithm'), handler.name),
        ]
        if hasattr(handler, "parsehash"):
            kwds = handler.parsehash(encoded, sanitize=mask_hash)
            for key, value in iteritems(kwds):
                key = self._translate_kwds.get(key, key)
                items.append((_(key), value))
        return OrderedDict(items) 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:17,代码来源:utils.py

示例8: getorig

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def getorig(self, path, default=None):
        """return original (unpatched) value for path"""
        try:
            value, _= self._state[path]
        except KeyError:
            value = self._get_path(path)
        return default if value is _UNSET else value 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:9,代码来源:utils.py

示例9: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self, vm, data, **kwargs):
        """Delete VM definition"""
        if vm.is_deployed():
            raise VmIsNotOperational(_('VM is not notcreated'))

        owner = vm.owner
        dead_vm = vm.log_list
        uuid = vm.uuid
        hostname = vm.hostname
        alias = vm.alias
        zabbix_sync = vm.is_zabbix_sync_active()
        external_zabbix_sync = vm.is_external_zabbix_sync_active()
        task_id = SuccessTaskResponse.gen_task_id(self.request, vm=dead_vm, owner=owner)

        # Every VM NIC could have an association to other tables. Cleanup first:
        for nic in vm.json_get_nics():
            # noinspection PyBroadException
            try:
                nic_ser = VmDefineNicSerializer(self.request, vm, nic)
                nic_ser.delete_ip(task_id)
            except Exception as ex:
                logger.exception(ex)
                continue

        # Finally delete VM
        logger.debug('Deleting VM %s from DB', vm)
        vm.delete()

        try:
            return SuccessTaskResponse(self.request, None, vm=dead_vm, owner=owner, task_id=task_id, msg=LOG_DEF_DELETE)
        finally:
            # Signal!
            vm_undefined.send(TaskID(task_id, request=self.request), vm_uuid=uuid, vm_hostname=hostname, vm_alias=alias,
                              dc=self.request.dc, zabbix_sync=zabbix_sync, external_zabbix_sync=external_zabbix_sync) 
开发者ID:erigones,项目名称:esdc-ce,代码行数:36,代码来源:vm_define.py

示例10: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self):
        dc, request = self.dc, self.request

        if dc.is_default():
            raise PreconditionRequired(_('Default datacenter cannot be deleted'))
        if dc.dcnode_set.exists():
            raise PreconditionRequired(_('Datacenter has nodes'))  # also "checks" DC backups
        if dc.vm_set.exists():
            raise PreconditionRequired(_('Datacenter has VMs'))
        if dc.backup_set.exists():
            raise PreconditionRequired(_('Datacenter has backups'))  # should be checked by dcnode check above

        dc_id = dc.id
        ser = self.serializer(request, dc)
        dc_bound_objects = dc.get_bound_objects()

        # After deleting a DC the current_dc is automatically set to DefaultDc by the on_delete db field parameter
        ser.object.delete()

        # Remove cached tasklog for this DC (DB tasklog entries will be remove automatically)
        delete_tasklog_cached(dc_id)

        res = SuccessTaskResponse(request, None)  # no msg => won't be logged

        # Every DC-bound object looses their DC => becomes DC-unbound
        task_id = res.data.get('task_id')

        connection.on_commit(lambda: dc_relationship_changed.send(task_id, dc_name=ser.object.name))  # Signal!

        # Update bound virt objects to be DC-unbound after DC removal
        for model, objects in dc_bound_objects.items():
            msg = LOG_VIRT_OBJECT_UPDATE_MESSAGES.get(model, None)
            if objects and msg:
                for obj in objects:
                    if obj.dc_bound:
                        # noinspection PyUnresolvedReferences
                        remove_dc_binding_virt_object(task_id, msg, obj, user=request.user, dc_id=DefaultDc.id)

        return res 
开发者ID:erigones,项目名称:esdc-ce,代码行数:41,代码来源:dc_view.py

示例11: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self):
        dc, net = self.request.dc, self.net

        if net.is_used_by_vms(dc=dc):
            raise PreconditionRequired(_('Network is used by some VMs'))

        ser = NetworkSerializer(self.request, net)
        net.dc.remove(dc)
        res = SuccessTaskResponse(self.request, None, obj=net, detail_dict=ser.detail_dict(), msg=LOG_NETWORK_DETACH)
        self._remove_dc_binding(res)

        return res 
开发者ID:erigones,项目名称:esdc-ce,代码行数:14,代码来源:api_views.py

示例12: delete

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import ugettext_noop [as 别名]
def delete(self):
        dc, vmt = self.request.dc, self.vmt

        if dc.vm_set.filter(template=vmt).exists():
            raise PreconditionRequired(_('Template is used by some VMs'))

        ser = self.serializer(self.request, vmt)
        vmt.dc.remove(dc)
        res = SuccessTaskResponse(self.request, None, obj=vmt, detail_dict=ser.detail_dict(), msg=LOG_TEMPLATE_DETACH)
        self._remove_dc_binding(res)

        return res 
开发者ID:erigones,项目名称:esdc-ce,代码行数:14,代码来源:api_views.py


注:本文中的django.utils.translation.ugettext_noop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。