Beispiel #1
0
def create_hash(options):
    """
    Create hash, mainly for passwords.
    Usage: paver create_hash -p mypass
    """

    import sys
    sys.path.insert(0, BASEDIR + '/GeoHealthCheck')
    from util import create_hash
    token = create_hash(options.get('password', None))
    info('Copy/paste the entire token below for example to set password')
    info(token)
Beispiel #2
0
    def update_schedule(self):
        _hash = create_hash(self.schedules)
        if _hash == self.__get_target_hash() and not self.common_diff:
            print("{0}:difference none.".format(self.prefix))
            return

        target_id = self.target_calendar['id']
        matching_id = []  # type: List[str]
        for schedule in self.schedules:
            schedule_hash = create_hash(schedule)
            _judgement_status, gcal_event_id = self.__get_judgement_status(
                target_id, schedule, schedule_hash)
            if _judgement_status != JudgementType.EQUAL_HASH:
                if _judgement_status == JudgementType.EQUAL_ID:
                    self.__delete_schedule(target_id, gcal_event_id)
                gcal_event_id = self.__register_schedule(
                    schedule, target_id, schedule_hash)
            matching_id.append(gcal_event_id)
        print('deleted cybozu schedule')
        self.__delete_deleted_cybozu_schedule(target_id, matching_id)
        print('update hash')
        self.__update_target_hash(target_id, _hash)
Beispiel #3
0
def conditional_save_common_hash(common: dict, prev_hash: str) -> bool:
    """
    パラメータcommonのhash値と、パラメータprev_hashが一致していなければ保存する
    一致、不一致を result として返す

    :param dict common: hash生成元dict
    :param str prev_hash: 前回のhash
    :return: common.__hash__ != prev_hash
    :rtype: bool
    """
    _hash = create_hash(common)
    common_diff = _hash != prev_hash
    if common_diff:
        __write_cache(_hash)
    return common_diff
 def encrypt(self, string):
     # https://passlib.readthedocs.io/en/stable/narr/hash-tutorial.html
     return util.create_hash(string)
Beispiel #5
0
 def encrypt(self, string):
     # https://passlib.readthedocs.io/en/stable/narr/hash-tutorial.html
     return util.create_hash(string)