示例#1
0
 def edit_item(self, item, logo, service, username, password, notes):
     '''
     This method can edit the attributes, the secret value
     and the label of the item in question.
     '''
     secret = repr((password, notes))
     value = Secret.Value(secret, len(secret), 'text/plain')
     item.set_secret_sync(value)
     attributes = {'logo': logo, 'service': service, 'username': username}
     item.set_attributes_sync(self.schema, attributes)
     item.set_label_sync(service + ': ' + username)
示例#2
0
 def create_item(self, logo, service, username, password, notes):
     '''
     This method creates an item on the collection
     currently in use, and returns that item.
     '''
     attributes = {'logo': logo, 'service': service, 'username': username}
     secret = repr((password, notes))
     value = Secret.Value(secret, len(secret), 'text/plain')
     args = (self.collection, self.schema, attributes,
             service + ': ' + username, value, Secret.ItemCreateFlags.NONE,
             None)
     item = Secret.Item.create_sync(*args)
     return item