Exemplo n.º 1
0
def lazy_load_dict(dict_path, dictionary_name, source_path, mapper=lambda x: x):
    if file_exists(dict_path, dictionary_name):
        dictionary = load(dict_path, dictionary_name)
    else:
        dictionary = create_dict(source_path)
        save(dictionary, dict_path, dictionary_name)
    return {mapper(k): v for k, v in dictionary.items()}
Exemplo n.º 2
0
 def add(self):
     self.verify()
     yield self.is_owner()
     yield files.save(self.request.files['file'][0]['body'],
                      'avatar',
                      set_id=self['avatar'],
                      name=self['name'])
Exemplo n.º 3
0
 def add(self):
     self.verify()
     published = yield self.is_owner()
     if published: raise Stink("can't add an image to a published page")
     yield files.save(self.request.files['file'][0]['body'],
                      'page',
                      set_id=self['page'])
Exemplo n.º 4
0
def save_level_info(level_info):
    save(level_info, level_info_path, level_info_file)
Exemplo n.º 5
0
def save_transitions(transitions):
    log.debug("Saving transitions")
    save(transitions, transition_path)
Exemplo n.º 6
0
 def save(self):
     import files
     import links
     print("Saving network ...")
     files.save(self.network, self.links)
Exemplo n.º 7
0
def reset():
    data = 'HISTORY\n'
    FILES.save(FILENAME, data)
Exemplo n.º 8
0
def saveEvent(type, seconds=0):
    print("HISTORY - SAVE EVENT")
    data = FILES.load(FILENAME)
    record = type + "|" + TIMES.now() + "|" + str(seconds) + "\n"
    data.append(record)
    FILES.save(FILENAME, data)
Exemplo n.º 9
0
 def add(self):
     self.verify()
     yield self.is_owner()
     yield files.save(self.request.files['file'][0]['body'], 'avatar', 
         set_id=self['avatar'], name=self['name'])
Exemplo n.º 10
0
 def add(self):
     self.verify()
     published = yield self.is_owner()
     if published: raise Stink("can't add an image to a published page")
     yield files.save(self.request.files['file'][0]['body'], 'page', set_id=self['page'])