|
From: Stas Z <sta...@gm...> - 2005-05-30 08:11:16
|
Hi Waseem.
I have some questions.
- Wouldn't it be better to rename Mylibgmail to GAlibgmail or
something to make it clear it's a fork
of the original libgmail.=20
(The original libgmail author doesn't respond to any of my mails, I
will however sent him a patch of everything we did so far.)
- At line 720 (added dots to preserve indentation, I hope):
for myTuple in addresses:
. # Each tuple has ~15 address entries
. for entry in myTuple:
. # Consider checking the length of entry before this?
. newGmailContact =3D GmailContact(entry[1], entry[2],
entry[4], entry[5])
. contactList.append(newGmailContact)
We could just wrap the whole entry slicing in a try/except block and
replace entries with
empty string on a exception ?
- At line 740:
. # TODO: In the ideal world, we'd extract these specific
. # constants into a nice constants file=20
What prevents us from creating a perfect world ?
(I mean a libgmail world of course ;-)
- At line 782:
. # TODO: Maybe make sure that this ID exists or something
. # smart like that?
Wrapping in a try/except block ?
- At line 799:
# TODO: Ensure that this is really a GmailContact?
# Also, maybe this could lead to weird bad cache coherence?
# Imaigne user A gets the contact list
# Then user B, using gmail, deletes contact X and adds contact Y
# which then gets contact X's id
# Then, A tries to delete X using this, but deletes Y
# by accident!
# So it's a concern to do things strictly by ID like this
# If we were smarter, we could fetch the contact list again
# and compare fields, I suppose
Isn't this important enough to fetch a new contacts list before removal ?
Gmail isn't a database so we can't block anything but perhaps getting a new=
list
is the second best.
- At line 842:
def getContactById(self, id):
"""
Returns the first contact in the
address book with the specified id.
Contact list *should* be unique by id
(unless gmail stops enforcing this)=20
Perhaps return every specified id, then let the user decide which he meant?
(The same for the getContactbyEmail method)
And then:
# This is going to be O(n), which sort of sucks
What do you mean by that?
Now I'm going to play with the contacts toy :-)
BTW, Do you have any ideas or plans for the future of
gmailagent/libgmail or is this a
one time project for you ?
Stas
--=20
"Everything that is really great and inspiring is created by the individual
who can labor in freedom."
-Albert Einstein
|