Forum Settings
Forums
New
Apr 26, 2009 7:58 AM
#1
Offline
Apr 2009
100
The code is well documented, but new people might have architecture questions. Personally I simply don't know Python best practices.

For starters, there can only ever be one instance of anime_data because the cookies are stored globally and used by functions in the myanimelist module, correct?

BTW MAL doesn't invalidate old sessions on each login, which could be considered a security hole, but means special clients don't interfere with normal browsers. For a different site I had to access the system-wide (WebKit at least) cookie storage of the Mac so as not to log out Safari every time...
Reply Disabled for Non-Club Members
Apr 26, 2009 4:53 PM
#2

Offline
Jun 2008
174
Well, yes. Did my best to do good design practices, writing modular and not too fancy code, using cleanly designed core data structures, interfaces and and documentation. That's also why there is this huge example code for the data in the data.py file. It is basically a representation of the XML data we get from mal, just converted to a python dict to make it easily usable. There is also a variation of this structure, which is only a further nesting for category separation, but I kept this incarnations short lived (they are used where they are created).

Understanding the above data structure is half understanding how the applitation works. Basically we pass around a reference to an anime_data instance. The anime_data class handles the data. It saves/loads the file, fetches and pushes data to the server and is used as data interface for the rest of the application. That's why I tried to make it as clean as possible, and that's why it is quite nicely built.

I have a writing of a white paper or description of the core data structure somewhere on my schedule. Quite at the top. Maybe it would be a good idea for someone else to try writing this, as it would show me where the code is not clear enough, so if someone tries it, nice, if not I'll probably do it sometime soon too.

About the cookies. Did not want to make them too difficult either. We are not writing a banking client here. If we would start to talk about serious security, then I would start with SSL and co. But of course cryptography is another hobby of mine and writing a design that would be a threat to the host system or the data would completely violate my principles -.- No, seriously, you did quite a good analysis on the working of the mynamielist login part there. Came up on development. Did a series of tests, and as the application only keeps the cookies as long it lives (i mean the app), so it was a viable option not to initiate a new cookie handler for every sync, just validating again, just in case the login credentials were invalidated somewhere on the way. Makes it more stable. Especially since we want to use it more later on. Accessing system wide cookies is not something I would like to do. Definitely not. ^^

It's late here, I'm half asleep already. I'll probably add something more comprehensive later -.-

Thanks for analysis.
-s
skriticosApr 26, 2009 5:10 PM
Apr 27, 2009 4:06 AM
#3

Offline
Jun 2008
174
So now I woke up. I wrote a quick overview for the data structures. It can be viewed here. Just to make a start :)
Reply Disabled for Non-Club Members

More topics from this board

Sticky: » AniChou package builds

kazooparcel - Apr 30, 2009

12 by Wile »»
Apr 12, 2013 12:34 AM

» AniDB support

Wile - Nov 27, 2009

1 by Necrotex »»
Nov 30, 2009 4:11 AM

Poll: » Searching a new name!

skriticos - Apr 29, 2009

37 by saka »»
Nov 1, 2009 11:14 AM

» Launchpad and an idea

newagemage - Jul 29, 2009

19 by Wile »»
Aug 24, 2009 1:37 AM

Sticky: » Wishlist

skriticos - Apr 27, 2009

19 by skriticos »»
May 13, 2009 1:45 AM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login