Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
240e9d6
Science fiction for expense report example application.
tseaver Aug 28, 2014
6a913d3
Update science-fiction CLI.
tseaver Oct 3, 2014
580fb03
Initial CLI skeleton to support datastore narrative example.
tseaver Oct 3, 2014
01d8f95
PEP8
tseaver Oct 9, 2014
6426aba
Suppress two useless PEP8 errors.
tseaver Oct 9, 2014
943f9df
Progress toward sample implementation.
tseaver Oct 13, 2014
e95392e
Get exp report creation actually working.
tseaver Oct 20, 2014
4f8c242
Use same Oauth envvars as regression tests.
tseaver Oct 22, 2014
d9c3af1
Enforce distinction between creating / updating expense reports.
tseaver Oct 22, 2014
afb287e
Add 'delete' command.
tseaver Oct 22, 2014
e836913
Add checks for valid report status to update / delete commands.
tseaver Oct 22, 2014
ebae693
Record metadata (description, created, updated) for expense reports.
tseaver Oct 22, 2014
666b6a4
Make 'review_expenses list' work with live data.
tseaver Oct 22, 2014
578d40a
Make 'review_expenses show' work with live data.
tseaver Oct 22, 2014
31dd159
Housekeeping.
tseaver Oct 22, 2014
7da8592
Reconcile command output w/ Sphinx.
tseaver Oct 22, 2014
7a58c95
Drop unneeded base exception.
tseaver Oct 22, 2014
b209068
Get 'review_expenses {approve,reject}' working w/ live data.
tseaver Oct 22, 2014
a98b440
Wire in the datastore narrative example.
tseaver Oct 22, 2014
42ecfe8
'csv' is not a known highlight syntax.
tseaver Oct 22, 2014
10e9f9f
Describe top-down flow of creating an expense report from a CSV file.
tseaver Oct 22, 2014
5090a3b
Add narrative for 'update_report'.
tseaver Oct 22, 2014
44812da
Typos, clarifications.
tseaver Oct 23, 2014
911ed7c
Add discussion of 'review_expenses list'.
tseaver Oct 23, 2014
8eadf43
Require 'employee_id' arg for 'review_expenses show'.
tseaver Oct 23, 2014
7f38c3a
Add discussion of 'review_expenses show'.
tseaver Oct 23, 2014
239d86f
Add discussion of 'review_expenses {approve,reject}'.
tseaver Oct 23, 2014
021b797
Cross-ref overview narrative to functional sections.
tseaver Oct 23, 2014
1579110
Add discussion of 'submit_expenses delete'.
tseaver Oct 23, 2014
4879512
Typo.
tseaver Oct 23, 2014
bdc32ab
Revert "Suppress two useless PEP8 errors."
tseaver Oct 23, 2014
bf5e420
PEP8.
tseaver Oct 23, 2014
b7e7f9c
pylint (reduced set, as in tests / demos / regression).
tseaver Oct 23, 2014
64cc17a
Typos.
tseaver Oct 23, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Require 'employee_id' arg for 'review_expenses show'.
  • Loading branch information
tseaver committed Oct 23, 2014
commit 8eadf438164403bf4d95dcbe09729c9a0bd48268
12 changes: 7 additions & 5 deletions docs/datastore-narrative_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ Sally can review a submitted expense report using the its ID:

.. code-block:: bash

$ review_expenses show expenses-2014-09-01
Report-ID: sally/expenses-2014-09-01
Report-Status: pending
$ review_expenses show sally expenses-2014-09-01
Employee-ID: sally
Report-ID: expenses-2014-09-01
Report-Status: pending
Created: 2014-09-04
Updated: 2014-09-04
Description: Frotz project kickoff, San Jose

"Date","Vendor","Type","Quantity","Price","Memo"
Expand Down Expand Up @@ -85,11 +87,11 @@ Sally's boss, Pat, can review all open expense reports:
"sally","expenses-2014-09-01","2014-09-04","2014-09-04","Frotz project kickoff, San Jose","pending",""


Pat can download Sally's report by supplying ``--employee-id=sally``:
Pat can download Sally's report:

.. code-block:: bash

$ review_expenses show --employee-id=sally expenses-2014-09-01
$ review_expenses show sally expenses-2014-09-01

This comment was marked as spam.

Report-ID: sally/expenses-2014-09-01
Report-Status: pending
Employee-ID: sally
Expand Down
14 changes: 3 additions & 11 deletions docs/examples/expenses/expenses/scripts/review_expenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,13 @@ def __init__(self, submitter, *args):
self.submitter = submitter
args = list(args)
parser = optparse.OptionParser(
usage="%prog [OPTIONS] REPORT_ID")

parser.add_option(
'-e', '--employee-id',
action='store',
dest='employee_id',
default=os.getlogin(),
help="ID of the employee whose expense reports to list")
usage="%prog [OPTIONS] EMPLOYEE_ID REPORT_ID")

options, args = parser.parse_args(args)
try:
self.report_id, = args
self.employee_id, self.report_id, = args
except:
raise InvalidCommandLine('Specify one report ID')
self.employee_id = options.employee_id
raise InvalidCommandLine('Specify employee ID, report ID')

def __call__(self):
_cols = ['Date', 'Vendor', 'Type', 'Quantity', 'Price', 'Memo']
Expand Down