http://codereview.appspot.com/2412041/diff/1/src/googlecl/finance/ser...
File src/googlecl/finance/service.py (right):
http://codereview.appspot.com/2412041/diff/1/src/googlecl/finance/ser...
src/googlecl/finance/service.py:95: return pfl
On 2010/10/10 17:30:49, Ed Bartosh wrote:
> On 2010/10/09 21:17:03, thmiller wrote:
> > Did you look at using googlecl.base.BaseCL.GetEntries() to do this?
If you
> only
> > need exactly one portfolio, use GetSingleEntry().
> I doubt it will be much better. Looks like I will end up
reimplementing
> Portfolio query.
You should be able to use the PortfolioQuery, just call ToUri() on it
before it gets sent to GetEntries. (see docs/service.py)
GetEntries will do that title matching for you, support regular
expression matches on the title, convert non-latin characters safely to
the URL, etc.
http://codereview.appspot.com/2412041/diff/1/src/googlecl/finance/ser...
src/googlecl/finance/service.py:162: print fmt % ('Id', 'Title', 'Curr',
'Gain', 'Gain %', 'C.basis',
On 2010/10/10 17:30:49, Ed Bartosh wrote:
> On 2010/10/09 21:17:03, thmiller wrote:
> > You should let the user decide what fields to list with the --fields
option.
> > picasa/service.py and contacts/base.py contain pretty extensive
wrapper
> classes
> > to base yours off of, or you can choose another way to do it.
> Done.
OK, the formatter looks pretty good. I may merge the two methods in the
future.
http://codereview.appspot.com/2412041/diff/1/src/googlecl/finance/ser...
src/googlecl/finance/service.py:232:
client.DeleteTransaction(transaction)
On 2010/10/10 17:30:49, Ed Bartosh wrote:
> On 2010/10/09 21:17:03, thmiller wrote:
> > Take a look at DeleteTransaction. I bet we can use DeleteEntry
instead, which
> is
> > sometimes helpful.
> I'm not sure I understand you here. Why using specific API should be
avoided in
> favor of more low-level one? I think it's more readable and
informative to use
> DeleteTransaction here. Moreover, if they change internals of
DeleteTransaction
> we shouldn't do anything, but if we use DeleteEntry something might
break in
> such a case.
All of the DeleteSpecificEntry functions in gdata are just wrappers to
Delete. Actually, in Finance's case, poorly defined wrappers -- you can
easily blunder into an AttributeError with DeletePortfolio. You're right
that it's bad practice to make the assumption, but it's been that way
since 1.2.4, and I don't expect that style to change any time soon.
delete_entry_list will also prompt the user before deleting something,
and allow a list of things to delete. As it's written now, the user has
to call _run_delete_transaction for every transaction deleted.
http://codereview.appspot.com/2412041/diff/8001/src/googlecl/finance/...
src/googlecl/finance/service.py:342:
This is an instance where it pays to use DeletePosition over googlecl's
delete_entry_list, though that means that a "are you SURE?" prompt needs
to be re-written for this case. Or delete_entry_list gets re-written
with a callback, instead of using Delete() every time.
http://codereview.appspot.com/2412041/