Giter VIP home page Giter VIP logo

Comments (3)

afg137 avatar afg137 commented on May 28, 2024

I finally figured this out by looking at the test cases here.

Turns out you have to call kp.reload() after the first kp.save() if you want to keep modifying binaries after a save.

Can this be made explicit in the documentation? In particular because other database actions (e.g., adding entries) do not require a reload if there is a save between them, so this behavior is non-standard and unintuitive.

(Even though the original problem has been fixed, I'll keep this issue open to flag the suggested documentation update.)

from pykeepass.

Evidlo avatar Evidlo commented on May 28, 2024

I'm not able to reproduce this with your example. Here's my slightly modified code

from pykeepass import PyKeePass

db, password, key = 'test4.kdbx', 'password', 'test4.key'

kp = PyKeePass(db, password, key)
print('before:', kp.binaries)

e = kp.add_entry(kp.root_group, "foo", "", "")
binary_id = kp.add_binary("bar".encode())
e.add_attachment(binary_id, "baz.txt")
kp.save()

kp.delete_binary(binary_id)
kp.save()

kp2 = PyKeePass(db, password, key)
print('after:', kp2.binaries)

I even deleted the self.kp_tmp.reload() you linked to in tests.py and the tests still pass.

from pykeepass.

Evidlo avatar Evidlo commented on May 28, 2024

I'll assume this is resolved. Reopen if not.

from pykeepass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.