Python django.utils.translation 模块,ugettext_noop() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用django.utils.translation.ugettext_noop()

项目:nrp    作者:django-rea    | 项目源码 | 文件源码
def create_use_cases(**kwargs):
    #UseCase.create('cash_contr', _('Cash Contribution'), True)
    UseCase.create('non_prod', _('Non-production Logging'), True)
    UseCase.create('rand', _('Manufacturing Recipes/Logging'))
    UseCase.create('recipe', _('Workflow Recipes/Logging'))
    UseCase.create('todo', _('Todos'), True)
    UseCase.create('cust_orders', _('Customer Orders'))
    UseCase.create('purchasing', _('Purchasing'))
    #UseCase.create('res_contr', _('Material Contribution'))
    #UseCase.create('purch_contr', _('Purchase Contribution'))
    #UseCase.create('exp_contr', _('Expense Contribution'), True)
    #UseCase.create('sale', _('Sale'))
    UseCase.create('distribution', _('Distribution'), True)
    UseCase.create('val_equation', _('Value Equation'), True)
    UseCase.create('payout', _('Payout'), True)
    #UseCase.create('transfer', _('Transfer'))
    UseCase.create('available', _('Make Available'), True)
    UseCase.create('intrnl_xfer', _('Internal Exchange'))
    UseCase.create('supply_xfer', _('Incoming Exchange'))
    UseCase.create('demand_xfer', _('Outgoing Exchange'))
    print "created use cases"
项目:ecs    作者:ecs-org    | 项目源码 | 文件源码
def checklist_workflow():
    EXTERNAL_REVIEW_GROUP = 'External Reviewer'
    EXECUTIVE_GROUP = 'EC-Executive'

    setup_workflow_graph(Checklist,
        auto_start=True, 
        nodes={
            'start': Args(Generic, start=True, name=_("Start")),
            'external_review': Args(ExternalReview, name=_("External Review"), group=EXTERNAL_REVIEW_GROUP, is_delegatable=False, is_dynamic=True),
            'external_review_review': Args(ExternalReviewReview, name=_("External Review Review"), group=EXECUTIVE_GROUP),
        },
        edges={
            ('start', 'external_review'): Args(guard=is_external_review_checklist),
            ('external_review', 'external_review_review'): None,
            ('external_review_review', 'external_review'): Args(guard=checklist_review_review_failed),
        }
    )
项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
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)
项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
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)
项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
def _check_img_server(self, must_exist=False):
        try:
            self.img_server = ImageVm()

            if self.img_server:
                img_vm = self.img_server.vm

                if img_vm.status not in (img_vm.RUNNING, img_vm.STOPPED):
                    raise ObjectDoesNotExist
            elif must_exist:
                raise ObjectDoesNotExist
            else:
                logger.warning('Image server is disabled!')

        except ObjectDoesNotExist:
            raise PreconditionRequired(_('Image server is not available'))
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        from django.contrib.auth.hashers import mask_hash
        from django.utils.translation import ugettext_noop as _
        from django.utils.datastructures import SortedDict
        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 SortedDict(items)

    # added in django 1.6
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
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)),
        ])
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
        assert algorithm == self.algorithm
        salt, checksum = data[:22], data[22:]
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('work factor'), work_factor),
            (_('salt'), mask_hash(salt)),
            (_('checksum'), mask_hash(checksum)),
        ])
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
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
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(encoded, show=3)),
        ])
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, data = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), salt),
            (_('hash'), mask_hash(data, show=3)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
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)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        (algorithm, variety, version, time_cost, memory_cost, parallelism,
            salt, data) = self._decode(encoded)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('variety'), variety),
            (_('version'), version),
            (_('memory cost'), memory_cost),
            (_('time cost'), time_cost),
            (_('parallelism'), parallelism),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(data)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
        assert algorithm == self.algorithm
        salt, checksum = data[:22], data[22:]
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('work factor'), work_factor),
            (_('salt'), mask_hash(salt)),
            (_('checksum'), mask_hash(checksum)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
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
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        assert encoded.startswith('sha1$$')
        hash = encoded[6:]
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(hash)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(encoded, show=3)),
        ])
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, data = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), salt),
            (_('hash'), mask_hash(data, show=3)),
        ])
项目:GAMADV-XTD    作者:taers232c    | 项目源码 | 文件源码
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)
项目:GAMADV-XTD    作者:taers232c    | 项目源码 | 文件源码
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
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
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)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        (algorithm, variety, version, time_cost, memory_cost, parallelism,
            salt, data) = self._decode(encoded)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('variety'), variety),
            (_('version'), version),
            (_('memory cost'), memory_cost),
            (_('time cost'), time_cost),
            (_('parallelism'), parallelism),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(data)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
        assert algorithm == self.algorithm
        salt, checksum = data[:22], data[22:]
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('work factor'), work_factor),
            (_('salt'), mask_hash(salt)),
            (_('checksum'), mask_hash(checksum)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
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
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        assert encoded.startswith('sha1$$')
        hash = encoded[6:]
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(hash)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(encoded, show=3)),
        ])
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, data = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), salt),
            (_('hash'), mask_hash(data, show=3)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
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)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        (algorithm, variety, version, time_cost, memory_cost, parallelism,
            salt, data) = self._decode(encoded)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('variety'), variety),
            (_('version'), version),
            (_('memory cost'), memory_cost),
            (_('time cost'), time_cost),
            (_('parallelism'), parallelism),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(data)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
        assert algorithm == self.algorithm
        salt, checksum = data[:22], data[22:]
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('work factor'), work_factor),
            (_('salt'), mask_hash(salt)),
            (_('checksum'), mask_hash(checksum)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
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
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        assert encoded.startswith('sha1$$')
        hash = encoded[6:]
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(hash)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(encoded, show=3)),
        ])
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, data = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), salt),
            (_('hash'), mask_hash(data, show=3)),
        ])
项目:nrp    作者:django-rea    | 项目源码 | 文件源码
def create_notice_types(verbosity, **kwargs):
        notification.NoticeType.create("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=2)
        notification.NoticeType.create("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=2)
        notification.NoticeType.create("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=2)
        notification.NoticeType.create("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=2)
        notification.NoticeType.create("valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=2)
        notification.NoticeType.create("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=2)
        notification.NoticeType.create("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=2)
        notification.NoticeType.create("work_membership_request", _("Freedom Coop Membership Request"), _("we have received a new membership request"), default=2)
        notification.NoticeType.create("work_join_request", _("Project Join Request"), _("we have received a new join request"), default=2)
        notification.NoticeType.create("work_new_account", _("Project New OCP Account"), _("a new OCP account details"), default=2)
        notification.NoticeType.create("comment_membership_request", _("Comment in Freedom Coop Membership Request"), _("we have received a new comment in a membership request"), default=2)
        notification.NoticeType.create("comment_join_request", _("Comment in Project Join Request"), _("we have received a new comment in a join request"), default=2)
        notification.NoticeType.create("work_skill_suggestion", _("Skill suggestion"), _("we have received a new skill suggestion"), default=2)
        print "created valueaccounting notice types"
项目:nrp    作者:django-rea    | 项目源码 | 文件源码
def create_event_types(**kwargs):
    #Keep the first column (name) as unique
    EventType.create('Citation', _('cites'), _('cited by'), 'cite', 'process', '=', '')
    EventType.create('Resource Consumption', _('consumes'), _('consumed by'), 'consume', 'process', '-', 'quantity')
    #EventType.create('Cash Contribution', _('contributes cash'), _('cash contributed by'), 'cash', 'exchange', '+', 'value')
    #EventType.create('Donation', _('donates cash'), _('cash donated by'), 'cash', 'exchange', '+', 'value')
    #EventType.create('Resource Contribution', _('contributes resource'), _('resource contributed by'), 'resource', 'exchange', '+', 'quantity')
    EventType.create('Damage', _('damages'), _('damaged by'), 'out', 'agent', '-', 'value')
    #EventType.create('Expense', _('expense'), '', 'expense', 'exchange', '=', 'value')
    EventType.create('Failed quantity', _('fails'), '', 'out', 'process', '<', 'quantity')
    #EventType.create('Payment', _('pays'), _('paid by'), 'pay', 'exchange', '-', 'value')
    EventType.create('Resource Production', _('produces'), _('produced by'), 'out', 'process', '+', 'quantity')
    EventType.create('Work Provision', _('provides'), _('provided by'), 'out', 'agent', '+', 'time')
    #EventType.create('Receipt', _('receives'), _('received by'), 'receive', 'exchange', '+', 'quantity')
    EventType.create('Sale', _('sells'), _('sold by'), 'out', 'agent', '=', '')
    #EventType.create('Shipment', _('ships'), _('shipped by'), 'shipment', 'exchange', '-', 'quantity')
    EventType.create('Supply', _('supplies'), _('supplied by'), 'out', 'agent', '=', '')
    EventType.create('Todo', _('todo'), '', 'todo', 'agent', '=', '')
    EventType.create('Resource use', _('uses'), _('used by'), 'use', 'process', '=', 'time')
    EventType.create('Time Contribution', _('work'), '', 'work', 'process', '=', 'time')
    EventType.create('Create Changeable', _('creates changeable'), 'changeable created', 'out', 'process', '+~', 'quantity')
    EventType.create('To Be Changed', _('to be changed'), '', 'in', 'process', '>~', 'quantity')
    EventType.create('Change', _('changes'), 'changed', 'out', 'process', '~>', 'quantity')
    EventType.create('Adjust Quantity', _('adjusts'), 'adjusted', 'adjust', 'agent', '+-', 'quantity')
    #EventType.create('Cash Receipt', _('receives cash'), _('cash received by'), 'receivecash', 'exchange', '+', 'value')
    EventType.create('Distribution', _('distributes'), _('distributed by'), 'distribute', 'distribution', '+', 'value')
    EventType.create('Cash Disbursement', _('disburses cash'), _('disbursed by'), 'disburse', 'distribution', '-', 'value')
    EventType.create('Payout', _('pays out'), _('paid by'), 'payout', 'agent', '-', 'value')
    #EventType.create('Loan', _('loans'), _('loaned by'), 'cash', 'exchange', '+', 'value')
    #EventType.create('Transfer', _('transfers'), _('transfered by'), 'transfer', 'exchange', '=', 'quantity')
    #EventType.create('Reciprocal Transfer', _('reciprocal transfers'), _('transfered by'), 'transfer', 'exchange', '=', 'quantity')
    #EventType.create('Fee', _('fees'), _('charged by'), 'fee', 'exchange', '-', 'value')
    EventType.create('Give', _('gives'), _('given by'), 'give', 'transfer', '-', 'quantity')
    EventType.create('Receive', _('receives'), _('received by'), 'receive', 'exchange', '+', 'quantity')
    #EventType.create('Make Available', _('makes available'), _('made available by'), 'available', 'agent', '+', 'quantity')

    print "created event types"
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
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)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        (algorithm, variety, version, time_cost, memory_cost, parallelism,
            salt, data) = self._decode(encoded)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('variety'), variety),
            (_('version'), version),
            (_('memory cost'), memory_cost),
            (_('time cost'), time_cost),
            (_('parallelism'), parallelism),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(data)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
        assert algorithm == self.algorithm
        salt, checksum = data[:22], data[22:]
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('work factor'), work_factor),
            (_('salt'), mask_hash(salt)),
            (_('checksum'), mask_hash(checksum)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
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
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, hash = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), mask_hash(salt, show=2)),
            (_('hash'), mask_hash(hash)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        assert encoded.startswith('sha1$$')
        hash = encoded[6:]
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(hash)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        return OrderedDict([
            (_('algorithm'), self.algorithm),
            (_('hash'), mask_hash(encoded, show=3)),
        ])
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
def safe_summary(self, encoded):
        algorithm, salt, data = encoded.split('$', 2)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('salt'), salt),
            (_('hash'), mask_hash(data, show=3)),
        ])
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
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)),
        ])