[Checkins] SVN: Sandbox/luciano/kirbi/ added pending searches admin
to kirbi; kirbifetch working with
Luciano Ramalho
luciano at ramalho.org
Tue Aug 7 00:00:36 EDT 2007
Log message for revision 78652:
added pending searches admin to kirbi; kirbifetch working with
amazon.com
Changed:
U Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/amazonsource.py
U Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/fetch.py
A Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780201400090.xml
A Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780471195726.xml
A Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/carroll-logic.xml
U Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/dummy_server.py
A Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/no_match.xml
A Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/test_amazon.txt
U Sandbox/luciano/kirbi/src/kirbi/app_templates/master.pt
U Sandbox/luciano/kirbi/src/kirbi/book.py
U Sandbox/luciano/kirbi/src/kirbi/pac.py
A Sandbox/luciano/kirbi/src/kirbi/pac_templates/addbooks.pt
A Sandbox/luciano/kirbi/src/kirbi/pac_templates/incomplete.pt
U Sandbox/luciano/kirbi/src/kirbi/pac_templates/index.pt
D Sandbox/luciano/kirbi/src/kirbi/pac_templates/pending.pt
A Sandbox/luciano/kirbi/src/kirbi/static/alibris16.gif
A Sandbox/luciano/kirbi/src/kirbi/static/alibris24.gif
A Sandbox/luciano/kirbi/src/kirbi/static/google16.gif
A Sandbox/luciano/kirbi/src/kirbi/static/google24.gif
A Sandbox/luciano/kirbi/src/kirbi/static/googlebook24.gif
U Sandbox/luciano/kirbi/src/kirbi/static/master.css
A Sandbox/luciano/kirbi/src/kirbi/static/worldcat16.gif
A Sandbox/luciano/kirbi/src/kirbi/static/worldcat24.gif
-=-
Modified: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/amazonsource.py
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/amazonsource.py 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/amazonsource.py 2007-08-07 04:00:34 UTC (rev 78652)
@@ -62,7 +62,7 @@
implements(IMetadataSource)
name = 'amazon.com'
- max_ids_per_request = 3
+ max_ids_per_request = 10
base_url = """http://ecs.amazonaws.com/onca/xml"""
Modified: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/fetch.py
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/fetch.py 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/fetch.py 2007-08-07 04:00:34 UTC (rev 78652)
@@ -9,6 +9,7 @@
from amazonsource import AmazonSource
from pprint import pprint
+from sys import stdout
KEEP_FILES = True
# directory where XML files will be saved (include trailing slash)
@@ -28,14 +29,17 @@
deferred.addCallback(self.polled).addErrback(self.pollError)
def polled(self, isbns):
- print 'polled: ', ' '.join(isbns)
i = 0
if isbns:
+ print 'polled:', ' '.join(isbns)
# fetch max_ids_per_request, and one request per second
for i, start in enumerate(range(0,len(isbns),
self.source.max_ids_per_request)):
end = start + self.source.max_ids_per_request
reactor.callLater(i, self.downloadItemsPage, isbns[start:end])
+ else:
+ stdout.write('.')
+ stdout.flush()
reactor.callLater(i+POLL_INTERVAL, self.poll)
def pollError(self, error):
@@ -94,9 +98,9 @@
if __name__ == '__main__':
- xmlrpc_url = 'http://localhost:8080/pac'
- poll_method = 'dump_incomplete_isbns'
- callback = 'add_books'
+ xmlrpc_url = 'http://localhost:8080/kirbi/pac'
+ poll_method = 'dumpIncomplete'
+ callback = 'updateBooks'
fetcher = Fetch(xmlrpc_url, poll_method, callback, AmazonSource())
reactor.callLater(0, fetcher.poll)
print 'reactor start'
Added: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780201400090.xml
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780201400090.xml (rev 0)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780201400090.xml 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
+ <OperationRequest>
+ <HTTPHeaders>
+ <Header Name="UserAgent" Value="Python-httplib2/$Rev: 235 $">
+ </Header>
+ </HTTPHeaders>
+ <RequestId>170SE9G2EQFGXEP247H5</RequestId>
+ <Arguments>
+ <Argument Name="SearchIndex" Value="Books">
+ </Argument>
+ <Argument Name="AssociateTag" Value="circulante-20">
+ </Argument>
+ <Argument Name="Service" Value="AWSECommerceService">
+ </Argument>
+ <Argument Name="ResponseGroup" Value="ItemAttributes">
+ </Argument>
+ <Argument Name="Operation" Value="ItemSearch">
+ </Argument>
+ <Argument Name="Power" Value="isbn:9780201400090">
+ </Argument>
+ <Argument Name="AWSAccessKeyId" Value="13W2MMDG65QJJK9GG402">
+ </Argument>
+ </Arguments>
+ <RequestProcessingTime>0.0636920928955078</RequestProcessingTime>
+ </OperationRequest>
+ <Items>
+ <Request>
+ <IsValid>True</IsValid>
+ <ItemSearchRequest>
+ <Power>isbn:9780201400090</Power>
+ <ResponseGroup>ItemAttributes</ResponseGroup>
+ <SearchIndex>Books</SearchIndex>
+ </ItemSearchRequest>
+ </Request>
+ <TotalResults>1</TotalResults>
+ <TotalPages>1</TotalPages>
+ <Item>
+ <ASIN>020140009X</ASIN>
+ <DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=020140009X%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/020140009X%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL>
+ <ItemAttributes>
+ <Author>Robert Sedgewick</Author>
+ <Author>Philippe Flajolet</Author>
+ <Binding>Paperback</Binding>
+ <Brand>Addison-Wesley Professional</Brand>
+ <DeweyDecimalNumber>005.1</DeweyDecimalNumber>
+ <EAN>9780201400090</EAN>
+ <Edition>1st</Edition>
+ <ISBN>020140009X</ISBN>
+ <Label>Addison-Wesley Professional</Label>
+ <ListPrice>
+ <Amount>6299</Amount>
+ <CurrencyCode>USD</CurrencyCode>
+ <FormattedPrice>$62.99</FormattedPrice>
+ </ListPrice>
+ <Manufacturer>Addison-Wesley Professional</Manufacturer>
+ <NumberOfItems>1</NumberOfItems>
+ <NumberOfPages>512</NumberOfPages>
+ <PackageDimensions>
+ <Height Units="hundredths-inches">120</Height>
+ <Length Units="hundredths-inches">890</Length>
+ <Weight Units="hundredths-pounds">150</Weight>
+ <Width Units="hundredths-inches">570</Width>
+ </PackageDimensions>
+ <ProductGroup>Book</ProductGroup>
+ <PublicationDate>1995-11-30</PublicationDate>
+ <Publisher>Addison-Wesley Professional</Publisher>
+ <Studio>Addison-Wesley Professional</Studio>
+ <Title>An Introduction to the Analysis of Algorithms</Title>
+ <UPC>785342400090</UPC>
+ </ItemAttributes>
+ </Item>
+ </Items>
+</ItemSearchResponse>
Added: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780471195726.xml
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780471195726.xml (rev 0)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/9780471195726.xml 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
+ <OperationRequest>
+ <HTTPHeaders>
+ <Header Name="UserAgent" Value="Python-httplib2/$Rev: 235 $">
+ </Header>
+ </HTTPHeaders>
+ <RequestId>0PYH9BW59Z7J0F9KHGC4</RequestId>
+ <Arguments>
+ <Argument Name="SearchIndex" Value="Books">
+ </Argument>
+ <Argument Name="AssociateTag" Value="circulante-20">
+ </Argument>
+ <Argument Name="Service" Value="AWSECommerceService">
+ </Argument>
+ <Argument Name="ResponseGroup" Value="ItemAttributes">
+ </Argument>
+ <Argument Name="Operation" Value="ItemSearch">
+ </Argument>
+ <Argument Name="Power" Value="isbn:9780471195726">
+ </Argument>
+ <Argument Name="AWSAccessKeyId" Value="13W2MMDG65QJJK9GG402">
+ </Argument>
+ </Arguments>
+ <RequestProcessingTime>0.0650789737701416</RequestProcessingTime>
+ </OperationRequest>
+ <Items>
+ <Request>
+ <IsValid>True</IsValid>
+ <ItemSearchRequest>
+ <Power>isbn:9780471195726</Power>
+ <ResponseGroup>ItemAttributes</ResponseGroup>
+ <SearchIndex>Books</SearchIndex>
+ </ItemSearchRequest>
+ </Request>
+ <TotalResults>1</TotalResults>
+ <TotalPages>1</TotalPages>
+ <Item>
+ <ASIN>0471195723</ASIN>
+ <DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=0471195723%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0471195723%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL>
+ <ItemAttributes>
+ <Author>Peter Sapaty</Author>
+ <Binding>Hardcover</Binding>
+ <Brand>Wiley-Interscience</Brand>
+ <DeweyDecimalNumber>004.36</DeweyDecimalNumber>
+ <EAN>9780471195726</EAN>
+ <ISBN>0471195723</ISBN>
+ <Label>Wiley-Interscience</Label>
+ <ListPrice>
+ <Amount>13395</Amount>
+ <CurrencyCode>USD</CurrencyCode>
+ <FormattedPrice>$133.95</FormattedPrice>
+ </ListPrice>
+ <Manufacturer>Wiley-Interscience</Manufacturer>
+ <NumberOfItems>1</NumberOfItems>
+ <NumberOfPages>432</NumberOfPages>
+ <PackageDimensions>
+ <Height Units="hundredths-inches">98</Height>
+ <Length Units="hundredths-inches">961</Length>
+ <Weight Units="hundredths-pounds">169</Weight>
+ <Width Units="hundredths-inches">634</Width>
+ </PackageDimensions>
+ <ProductGroup>Book</ProductGroup>
+ <PublicationDate>1999-02-22</PublicationDate>
+ <Publisher>Wiley-Interscience</Publisher>
+ <Studio>Wiley-Interscience</Studio>
+ <Title>Mobile Processing in Distributed and Open Environments (Wiley Series on Parallel and Distributed Computing)</Title>
+ </ItemAttributes>
+ </Item>
+ </Items>
+</ItemSearchResponse>
Added: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/carroll-logic.xml
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/carroll-logic.xml (rev 0)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/carroll-logic.xml 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
+ <OperationRequest>
+ <HTTPHeaders>
+ <Header Name="UserAgent" Value="Python-httplib2/$Rev: 235 $"></Header>
+ </HTTPHeaders>
+ <RequestId>05VS0MD1ZA1H8HN5E139</RequestId>
+ <Arguments>
+ <Argument Name="SearchIndex" Value="Books"></Argument>
+ <Argument Name="AssociateTag" Value="circulante-20"></Argument>
+ <Argument Name="Service" Value="AWSECommerceService"></Argument>
+ <Argument Name="ResponseGroup" Value="ItemAttributes"></Argument>
+ <Argument Name="Operation" Value="ItemSearch"></Argument>
+ <Argument Name="Power" Value="author:lewis carroll and title:logic"></Argument>
+ <Argument Name="AWSAccessKeyId" Value="13W2MMDG65QJJK9GG402"></Argument>
+ </Arguments>
+ <RequestProcessingTime>0.129734039306641</RequestProcessingTime>
+ </OperationRequest>
+ <Items>
+ <Request>
+ <IsValid>True</IsValid>
+ <ItemSearchRequest>
+ <Power>author:lewis carroll and title:logic</Power>
+ <ResponseGroup>ItemAttributes</ResponseGroup>
+ <SearchIndex>Books</SearchIndex>
+ </ItemSearchRequest>
+ </Request>
+ <TotalResults>21</TotalResults>
+ <TotalPages>3</TotalPages>
+ <Item>
+ <ASIN>0486204928</ASIN>
+ <DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=0486204928%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0486204928%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL>
+ <ItemAttributes>
+ <Author>Lewis Carroll</Author>
+ <Binding>Paperback</Binding>
+ <DeweyDecimalNumber>793.74</DeweyDecimalNumber>
+ <EAN>9780486204925</EAN>
+ <Edition>New Issue</Edition>
+ <ISBN>0486204928</ISBN>
+ <Label>Dover Publications</Label>
+ <ListPrice>
+ <Amount>1195</Amount>
+ <CurrencyCode>USD</CurrencyCode>
+ <FormattedPrice>$11.95</FormattedPrice>
+ </ListPrice>
+ <Manufacturer>Dover Publications</Manufacturer>
+ <NumberOfItems>1</NumberOfItems>
+ <NumberOfPages>352</NumberOfPages>
+ <PackageDimensions>
+ <Height Units="hundredths-inches">70</Height>
+ <Length Units="hundredths-inches">780</Length>
+ <Weight Units="hundredths-pounds">70</Weight>
+ <Width Units="hundredths-inches">540</Width>
+ </PackageDimensions>
+ <ProductGroup>Book</ProductGroup>
+ <PublicationDate>1958-06-01</PublicationDate>
+ <Publisher>Dover Publications</Publisher>
+ <Studio>Dover Publications</Studio>
+ <Title>Symbolic Logic and the Game of Logic</Title>
+ </ItemAttributes>
+ </Item>
+ <Item>
+ <ASIN>B00088TPJQ</ASIN>
+ <DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B00088TPJQ%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B00088TPJQ%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL>
+ <ItemAttributes>
+ <Author>Lewis Carroll</Author>
+ <Binding>Unknown Binding</Binding>
+ <Label>Macmillan</Label>
+ <Manufacturer>Macmillan</Manufacturer>
+ <ProductGroup>Book</ProductGroup>
+ <PublicationDate>1896</PublicationDate>
+ <Publisher>Macmillan</Publisher>
+ <Studio>Macmillan</Studio>
+ <Title>A fascinating mental recreation for the young: Symbolic logic</Title>
+ </ItemAttributes>
+ </Item>
+ <Item><ASIN>1406927236</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=1406927236%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/1406927236%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Paperback</Binding><EAN>9781406927238</EAN><ISBN>1406927236</ISBN><Label>Hard Press</Label><ListPrice><Amount>995</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$9.95</FormattedPrice></ListPrice><Manufacturer>Hard Press</Manufacturer><NumberOfPages>74</NumberOfPages><PackageDimensions><Height Units="hundredths-inches">400</Height><Length Units="hundredths-inches">900</Length><Weight Units="hundredths-pounds">87</Weight><Width Units="hundredths-inches">600</Width></PackageDimensions><ProductGroup>Book</ProductGroup><PublicationDate>2006-11-09</PublicationDate><Publisher>Hard Press</Publisher><ReleaseDate>2006-11-03</ReleaseDate><Studio>Hard Press</Studio><Title>The Game of Logic</Title></ItemAttributes></Item>
+ <Item><ASIN>0517523833</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=0517523833%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0517523833%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Author>Charles Lutwidge Dodgson</Author><Binding>Hardcover</Binding><Brand>Clarkson Potter</Brand><Creator Role="Editor">III William Warren Bartley</Creator><DeweyDecimalNumber>511.3</DeweyDecimalNumber><EAN>9780517523834</EAN><ISBN>0517523833</ISBN><Label>Clarkson N. Potter</Label><ListPrice><Amount>1995</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$19.95</FormattedPrice></ListPrice><Manufacturer>Clarkson N. Potter</Manufacturer><NumberOfItems>1</NumberOfItems><NumberOfPages>496</NumberOfPages><ProductGroup>Book</ProductGroup><PublicationDate>1977-03-23</PublicationDate><Publisher>Clarkson N. Potter</Publisher><ReleaseDate>1977-03-23</ReleaseDate><Studio>Clarkson N. Potter</Studio><Title>Lewis Carroll's Symbolic Logic</Title></ItemAttributes></Item>
+ <Item><ASIN>B000O037CY</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B000O037CY%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B000O037CY%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Paperback</Binding><Label>Dover Publications, Inc</Label><Manufacturer>Dover Publications, Inc</Manufacturer><ProductGroup>Book</ProductGroup><PublicationDate>1958</PublicationDate><Publisher>Dover Publications, Inc</Publisher><Studio>Dover Publications, Inc</Studio><Title>Mathematical Recreations of Lewis Carroll: Symbolic Logic and The Game of Logic (Both Books Bound as One)</Title></ItemAttributes></Item>
+ <Item><ASIN>B00072J05C</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B00072J05C%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B00072J05C%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Unknown Binding</Binding><Label>Perfection Form Co</Label><Manufacturer>Perfection Form Co</Manufacturer><NumberOfPages>45</NumberOfPages><ProductGroup>Book</ProductGroup><PublicationDate>1972</PublicationDate><Publisher>Perfection Form Co</Publisher><Studio>Perfection Form Co</Studio><Title>Puzzles in logic</Title></ItemAttributes></Item>
+ <Item><ASIN>B00085JEYK</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B00085JEYK%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B00085JEYK%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Unknown Binding</Binding><Edition>2nd ed</Edition><Label>MacMillan</Label><Manufacturer>MacMillan</Manufacturer><NumberOfPages>192</NumberOfPages><ProductGroup>Book</ProductGroup><PublicationDate>1896</PublicationDate><Publisher>MacMillan</Publisher><Studio>MacMillan</Studio><Title>Symbolic logic</Title></ItemAttributes></Item>
+ <Item><ASIN>B0006VUZEO</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B0006VUZEO%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B0006VUZEO%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Unknown Binding</Binding><Label>Dover Publications</Label><Manufacturer>Dover Publications</Manufacturer><NumberOfPages>96</NumberOfPages><ProductGroup>Book</ProductGroup><PublicationDate>1972</PublicationDate><Publisher>Dover Publications</Publisher><Studio>Dover Publications</Studio><Title>Symbolic logic and The game of logic;: Mathematical recreations of Lewis Carroll</Title></ItemAttributes></Item>
+ <Item><ASIN>B000J4NG0S</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B000J4NG0S%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B000J4NG0S%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Paperback</Binding><Label>Dover Publications</Label><Manufacturer>Dover Publications</Manufacturer><ProductGroup>Book</ProductGroup><PublicationDate>1958</PublicationDate><Publisher>Dover Publications</Publisher><Studio>Dover Publications</Studio><Title>Symbolic Logic Game of Logic: Mathematical Recreations of Lewis Carroll 2 Books Bound As 1</Title></ItemAttributes></Item>
+ <Item><ASIN>B000H0075G</ASIN><DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B000H0075G%26tag=circulante-20%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/B000H0075G%253FSubscriptionId=13W2MMDG65QJJK9GG402</DetailPageURL><ItemAttributes><Author>Lewis Carroll</Author><Binding>Paperback</Binding><Label>Berkeley Enterprises</Label><Manufacturer>Berkeley Enterprises</Manufacturer><ProductGroup>Book</ProductGroup><PublicationDate>1955</PublicationDate><Publisher>Berkeley Enterprises</Publisher><Studio>Berkeley Enterprises</Studio><Title>Symbolic Logic, Part 1: Elementary (Fourth Edition)</Title></ItemAttributes></Item>
+ </Items>
+</ItemSearchResponse>
Modified: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/dummy_server.py
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/dummy_server.py 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/dummy_server.py 2007-08-07 04:00:34 UTC (rev 78652)
@@ -14,7 +14,7 @@
if incomplete is not None:
self.incomplete = incomplete
- def add_incomplete_isbns(self, isbns):
+ def addIncomplete(self, isbns):
print 'add%s' % isbns
added = 0
for isbn in isbns:
@@ -23,7 +23,7 @@
added += 1
return added
- def del_incomplete_isbns(self, isbns):
+ def delIncomplete(self, isbns):
print 'del%s' % isbns
deleted = 0
for isbn in isbns:
@@ -32,11 +32,11 @@
deleted += 1
return deleted
- def show_incomplete_isbns(self):
+ def listIncomplete(self):
print 'list%s' % self.incomplete
return self.incomplete
- def dump_incomplete_isbns(self, max=0):
+ def dumpIncomplete(self, max=0):
print 'dump%s' % self.incomplete
if max == 0:
max = len(self.incomplete)
@@ -44,12 +44,12 @@
self.incomplete = self.incomplete[max:]
return dump
- def add_books(self, books):
- print 'added:'
+ def updateBooks(self, books):
+ print 'updated:'
pprint(books)
return len(books)
- def add_error(self, isbn, msg):
+ def addError(self, isbn, msg):
print 'error(%s): %s' % (isbn, msg)
Added: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/no_match.xml
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/no_match.xml (rev 0)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/no_match.xml 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,45 @@
+'<?xml version="1.0" encoding="UTF-8"?>
+<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
+ <OperationRequest>
+ <HTTPHeaders>
+ <Header Name="UserAgent" Value="Python-httplib2/$Rev: 235 $">
+ </Header>
+ </HTTPHeaders>
+ <RequestId>1753N5KPEHGVE0NDTK5B</RequestId>
+ <Arguments>
+ <Argument Name="SearchIndex" Value="Books">
+ </Argument>
+ <Argument Name="AssociateTag" Value="circulante-20">
+ </Argument>
+ <Argument Name="Service" Value="AWSECommerceService">
+ </Argument>
+ <Argument Name="ResponseGroup" Value="ItemAttributes">
+ </Argument>
+ <Argument Name="Operation" Value="ItemSearch">
+ </Argument>
+ <Argument Name="Power" Value="isbn:xxxx">
+ </Argument>
+ <Argument Name="AWSAccessKeyId" Value="13W2MMDG65QJJK9GG402">
+ </Argument>
+ </Arguments>
+ <RequestProcessingTime>0.0375111103057861</RequestProcessingTime>
+ </OperationRequest>
+ <Items>
+ <Request>
+ <IsValid>True</IsValid>
+ <ItemSearchRequest>
+ <Power>isbn:xxxx</Power>
+ <ResponseGroup>ItemAttributes</ResponseGroup>
+ <SearchIndex>Books</SearchIndex>
+ </ItemSearchRequest>
+ <Errors>
+ <Error>
+ <Code>AWS.ECommerceService.NoExactMatches</Code>
+ <Message>We did not find any matches for your request.</Message>
+ </Error>
+ </Errors>
+ </Request>
+ <TotalResults>0</TotalResults>
+ <TotalPages>0</TotalPages>
+ </Items>
+</ItemSearchResponse>'
Added: Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/test_amazon.txt
===================================================================
--- Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/test_amazon.txt (rev 0)
+++ Sandbox/luciano/kirbi/kirbifetch/src/kirbifetch/tests/test_amazon.txt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,12 @@
+ from amazon_config import ACCESS_KEY_ID, ASSOCIATE_TAG
+ ecs = AmazonECS(ACCESS_KEY_ID, ASSOCIATE_TAG)
+
+ #print ecs.itemSearch('author:lewis carroll and title:logic')
+ #print ecs.itemSearch('isbn:'+sys.argv[1])
+ #s = xmlrpclib.Server('http://localhost:8080')
+ #l = s.list_pending_isbns()
+ l = ['0333647289']
+ #l = ['9780333647288']
+ ecs.isbnSearch(l)
+ pprint(ecs.parse())
+ #pprint(r)
Modified: Sandbox/luciano/kirbi/src/kirbi/app_templates/master.pt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/app_templates/master.pt 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/app_templates/master.pt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -30,7 +30,7 @@
<li><a tal:attributes="href python:view.application_url()">collection</a></li>
<li><a tal:attributes="href python:view.application_url()">friends</a></li>
<li><a tal:attributes="href python:view.application_url()">leases</a></li>
- <li><a tal:attributes="href python:view.application_url('pac')+'/pending'">pending</a></li>
+ <li><a tal:attributes="href python:view.application_url('pac')+'/incomplete'">incomplete</a></li>
</ul>
</div>
<div metal:define-slot="body">
Modified: Sandbox/luciano/kirbi/src/kirbi/book.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/book.py 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/book.py 2007-08-07 04:00:34 UTC (rev 78652)
@@ -53,10 +53,13 @@
default=())
source = schema.TextLine(title=u"Record source",
+ required=False,
description=u"Name of the source of this record.")
source_url = schema.URI(title=u"Source URL",
+ required=False,
description=u"URL of the source of this record.")
source_item_id = schema.TextLine(title=u"Item ID at Source",
+ required=False,
description= (u"Product number or other identifier"
u" for this item at source.")
)
@@ -108,12 +111,15 @@
__isbn13 = '' # ISBN-13, digits only (no dashes)
__language = None
- def __init__(self, title='', isbn13=None, creators=None, edition=None,
- publisher=None, issued=None, language=None, subjects=None,
- source=None, source_url=None, source_item_id=None):
+ def __init__(self, title='', isbn13=None, isbn=None,
+ creators=None, edition=None, publisher=None, issued=None,
+ language=None, subjects=None, source=None, source_url=None,
+ source_item_id=None):
super(Book, self).__init__()
if isbn13:
self.isbn13 = isbn13
+ elif isbn:
+ self.isbn = isbn
# Note: the title is set after the isbn13 so the language can be
# guessed from the isbn13 and the __filing_title can be set
self.title = title
@@ -279,6 +285,10 @@
def searchableText(self):
return self.title + ' ' + ' '.join(self.creators)
+
+ def update(self, **kwargs):
+ for key, value in kwargs.items():
+ setattr(self,key,value)
class Edit(grok.EditForm):
Modified: Sandbox/luciano/kirbi/src/kirbi/pac.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac.py 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/pac.py 2007-08-07 04:00:34 UTC (rev 78652)
@@ -3,6 +3,7 @@
from zope.app.container.contained import NameChooser as BaseNameChooser
from zope.app.container.interfaces import INameChooser
from zope.interface import implements
+from zope import schema
from operator import attrgetter
from isbn import isValidISBN, isValidISBN10, convertISBN10toISBN13, filterDigits
@@ -26,6 +27,9 @@
def __init__(self):
super(Pac, self).__init__()
+ # books with isbn but no title
+ self.incomplete_isbns = PersistentDict()
+ # isbns sent for fetching
self.pending_isbns = PersistentDict()
def addBook(self, book):
@@ -33,33 +37,69 @@
self[name] = book
return book.__name__
- def listPending(self):
- return list(self.pending_isbns)
+ def getIncomplete(self):
+ return self.incomplete_isbns
- def delPending(self, isbns):
- deleted = 0
- for isbn in isbns:
- if isbn in self.context.pending_isbns:
- del self.context.pending_isbns[isbn]
- deleted += 1
- return deleted
+ def addIncomplete(self, isbn13):
+ timestamp = strftime('%Y-%m-%d %H:%M:%S',localtime())
+ self.incomplete_isbns[isbn13] = timestamp
+ def getPending(self):
+ return self.pending_isbns
+ def dumpIncomplete(self):
+ dump = list(self.incomplete_isbns)
+ self.pending_isbns.update(self.incomplete_isbns)
+ self.incomplete_isbns.clear()
+ return dump
+
+ def retryPending(self, isbns):
+ for isbn13 in isbns:
+ if isbn13 in self.pending_isbns:
+ self.incomplete_isbns[isbn13] = self.pending_isbns[isbn13]
+ del self.pending_isbns[isbn13]
+
+ def updateBooks(self, book_dict_list):
+ updated = 0
+ for book_dict in book_dict_list:
+ isbn13 = book_dict.get('isbn13')
+ if isbn13 not in self.pending_isbns:
+ msg = '%s not in pending ISBNs; update not allowed.' % isbn13
+ raise LookupError, msg
+ if isbn13 in self:
+ book = self[isbn13]
+ book.update(**book_dict)
+ del self.pending_isbns[isbn13]
+ updated += 1
+ return updated
+
@grok.subscribe(Book, grok.IObjectAddedEvent)
def bookAdded(book, event):
- if not book.title:
+ if not book.title and book.isbn13:
pac = book.__parent__
- timestamp = strftime('%Y-%m-%d %H:%M:%S',localtime())
- pac.pending_isbns[book.isbn13] = timestamp
+ pac.addIncomplete(book.isbn13)
-class Pending(grok.View):
- def pending_isbns(self):
- pending = []
- for isbn, timestamp in self.context.pending_isbns.items():
- pending.append((timestamp, isbn))
+class Incomplete(grok.View):
+ def sortedByTime(self, isbn_dict):
+ pairs = ((timestamp, isbn) for isbn, timestamp in
+ isbn_dict.items())
return (dict(timestamp=timestamp,isbn=isbn)
- for timestamp, isbn in sorted(pending))
+ for timestamp, isbn in sorted(pairs))
+
+ def incompleteIsbns(self):
+ return list(self.sortedByTime(self.context.getIncomplete()))
+ def pendingIsbns(self):
+ return list(self.sortedByTime(self.context.getPending()))
+
+ def update(self, isbns=None):
+ if isbns:
+ self.context.retryPending(isbns)
+ if self.context.getIncomplete() or self.context.getPending():
+ self.request.response.setHeader("Refresh", "5; url=%s" % self.url())
+
+
+
class Index(grok.View):
def update(self, query=None):
@@ -116,6 +156,27 @@
self.applyData(book, **data)
self.context.addBook(book)
self.redirect(self.url(self.context))
+
+class AddBooks(grok.View):
+
+ invalid_isbns = []
+
+ def update(self, isbns=None):
+ if isbns is not None:
+ isbns = isbns.split()
+ for isbn in isbns:
+ self.invalid_isbns = []
+ if isValidISBN(isbn):
+ book = Book(isbn=isbn)
+ self.context.addBook(book)
+ else:
+ self.invalid_isbns.append(isbn)
+
+ def invalidISBNs(self):
+ if self.invalid_isbns:
+ return '\n'.join(self.invalid_isbns)
+ else:
+ return ''
class NameChooser(grok.Adapter, BaseNameChooser):
implements(INameChooser)
@@ -156,12 +217,14 @@
book = Book(**book_dict)
return self.context.addBook(book)
- def list_pending_isbns(self):
- return self.context.listPending()
+ def updateBooks(self, book_dict_list):
+ return self.context.updateBooks(book_dict_list)
- def del_pending_isbns(self, isbns):
- return self.delPending(isbns)
+ def dumpIncomplete(self):
+ return self.context.dumpIncomplete()
+
+
class ImportDemo(grok.View):
def render(self):
Added: Sandbox/luciano/kirbi/src/kirbi/pac_templates/addbooks.pt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac_templates/addbooks.pt (rev 0)
+++ Sandbox/luciano/kirbi/src/kirbi/pac_templates/addbooks.pt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,41 @@
+<html metal:use-macro="context/@@master/page">
+<head>
+ <title metal:fill-slot="title">
+ Public Catalog
+ </title>
+
+</head>
+<body>
+ <span metal:fill-slot="content_title">Collective catalog</span>
+ <span metal:fill-slot="content_actions">
+ <form class="search" action=".">
+ <input type="text" name="query">
+ <input type="submit" name="submit" value="search">
+ </form>
+ </span>
+ <div metal:fill-slot="content">
+
+ <form tal:attributes="action view/url" method="post">
+ <p>Type or scan several ISBNs separated by spaces or newlines.</p>
+ <p>Either 10 or 13-digit ISBNs can be used.</p>
+ <textarea name="isbns" rows="30" cols="40"
+ tal:content="view/invalidISBNs">
+ </textarea>
+ <br />
+ <input type="submit" value="Add books">
+ <br />
+ <p tal:condition="view/invalidISBNs">
+ The numbers remaining in the field above are not valid ISBN-10
+ or ISBN-13.
+ </p>
+ </form>
+
+ <form tal:condition="view/demo_link|nothing"
+ tal:attributes="action python:view.url('importdemo')" method="post">
+ <input type="submit" value="Import a demo collection">
+ </form>
+
+
+ </div>
+</body>
+</html>
Copied: Sandbox/luciano/kirbi/src/kirbi/pac_templates/incomplete.pt (from rev 78583, Sandbox/luciano/kirbi/src/kirbi/pac_templates/pending.pt)
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac_templates/incomplete.pt (rev 0)
+++ Sandbox/luciano/kirbi/src/kirbi/pac_templates/incomplete.pt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -0,0 +1,118 @@
+<html metal:use-macro="context/@@master/page">
+<head>
+ <title metal:fill-slot="title">
+ Public Catalog
+ </title>
+
+</head>
+<body>
+ <span metal:fill-slot="content_title">Collective catalog</span>
+ <span metal:fill-slot="content_actions">
+ <form class="search" action=".">
+ <input type="text" name="query">
+ <input type="submit" name="submit" value="search">
+ </form>
+ </span>
+ <div metal:fill-slot="content">
+
+ <div tal:condition="view/incompleteIsbns">
+ <h3>New Book Records Without Title</h3>
+ <table class="isbn_list">
+ <tr tal:repeat="item view/incompleteIsbns">
+ <th align="right" tal:content="repeat/item/number" />
+ <td tal:content="item/timestamp" />
+ <td>
+ <a tal:attributes="href python:view.url(item['isbn'])+'/details'"
+ tal:content="item/isbn">9780123456789</a>
+
+ </td>
+ </tr>
+ </table>
+ </div>
+ <p tal:condition="not:view/incompleteIsbns">No new book records without title.</p>
+
+ <form tal:condition="view/pendingIsbns" method="post"
+ tal:attributes="action view/url">
+ <h3>Pending Book Searches</h3>
+ <table class="isbn_list">
+ <tr>
+ <th><input type="checkbox" name="select_all"></th>
+ <th>#</th>
+ <th>Created</th>
+ <th>ISBN-13</th>
+ <th>
+ <a tal:attributes="href string:http://www.worldcatlibraries.org/"
+ title="WorldCat Libraries Search">
+ <img tal:attributes="src static/worldcat24.gif" />
+ </a>
+ </th>
+ <th>
+ <a tal:attributes="href string:http://www.alibris.com/search/search.cfm"
+ title="Alibris Book Search">
+ <img tal:attributes="src static/alibris24.gif" />
+ </a>
+ </th>
+ <th>
+ <a tal:attributes="href string:http://books.google.com/"
+ title="Google Book Search">
+ <img tal:attributes="src static/googlebook24.gif" />
+ </a>
+ </th>
+ <th>
+ <a tal:attributes="href string:http://google.com/"
+ title="Google Search">
+ <img tal:attributes="src static/google24.gif" />
+ </a>
+ </th>
+ </tr>
+ <tr tal:repeat="item view/pendingIsbns">
+ <td>
+ <input type="checkbox" name="isbns:list"
+ tal:attributes="value item/isbn" />
+
+ </td>
+ <th align="right" tal:content="repeat/item/number" />
+ <td tal:content="item/timestamp" />
+ <td>
+ <a tal:attributes="href python:view.url(item['isbn'])+'/details'"
+ tal:content="item/isbn">9780123456789</a>
+
+ </td>
+ <td>
+ <a tal:attributes="href string:http://www.worldcatlibraries.org/search?q=${item/isbn}"
+ title="WorldCat Libraries Search">
+ <img tal:attributes="src static/worldcat16.gif" />
+ </a>
+ </td>
+ <td>
+ <a tal:attributes="href string:http://www.alibris.com/search/search.cfm?wtit=${item/isbn}"
+ title="Alibris Book Search">
+ <img tal:attributes="src static/alibris16.gif" />
+ </a>
+ </td>
+ <td>
+ <a tal:attributes="href string:http://books.google.com/books?q=${item/isbn}"
+ title="Google Book Search">
+ <img tal:attributes="src static/google16.gif" />
+ </a>
+ </td>
+ <td>
+ <a tal:attributes="href string:http://google.com/search?q=${item/isbn}"
+ title="Google Search">
+ <img tal:attributes="src static/google16.gif" />
+ </a>
+
+ </td>
+ </tr>
+ </table>
+ <input type="submit" name="retry" value="Retry">
+ </form>
+ <p tal:condition="not:view/pendingIsbns">No pending book searches.</p>
+
+ <p><a tal:attributes="href python:view.url('addbook')">
+ Add Book
+ </a></p>
+
+ </div>
+</body>
+</html>
Modified: Sandbox/luciano/kirbi/src/kirbi/pac_templates/index.pt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac_templates/index.pt 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/pac_templates/index.pt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -44,6 +44,9 @@
<p><a tal:attributes="href python:view.url('addbook')">
Add Book
</a></p>
+ <p><a tal:attributes="href python:view.url('addbooks')">
+ Add Several Books
+ </a></p>
</div>
</body>
Deleted: Sandbox/luciano/kirbi/src/kirbi/pac_templates/pending.pt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac_templates/pending.pt 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/pac_templates/pending.pt 2007-08-07 04:00:34 UTC (rev 78652)
@@ -1,37 +0,0 @@
-<html metal:use-macro="context/@@master/page">
-<head>
- <title metal:fill-slot="title">
- Public Catalog
- </title>
-
-</head>
-<body>
- <span metal:fill-slot="content_title">Collective catalog</span>
- <span metal:fill-slot="content_actions">
- <form class="search" action=".">
- <input type="text" name="query">
- <input type="submit" name="submit" value="search">
- </form>
- </span>
- <div metal:fill-slot="content">
-
- <h3>Pending ISBNs</h3>
- <table tal:condition="view/pending_isbns">
- <tr tal:repeat="item view/pending_isbns">
- <th align="right" tal:content="repeat/item/number" />
- <td tal:content="item/timestamp" />
- <td>
- <a tal:attributes="href python:view.url(item['isbn'])+'/details'"
- tal:content="item/isbn">9780123456789</a>
-
- </td>
- </tr>
- </table>
-
- <p><a tal:attributes="href python:view.url('addbook')">
- Add Book
- </a></p>
-
- </div>
-</body>
-</html>
Added: Sandbox/luciano/kirbi/src/kirbi/static/alibris16.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/alibris16.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Sandbox/luciano/kirbi/src/kirbi/static/alibris24.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/alibris24.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Sandbox/luciano/kirbi/src/kirbi/static/google16.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/google16.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Sandbox/luciano/kirbi/src/kirbi/static/google24.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/google24.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Sandbox/luciano/kirbi/src/kirbi/static/googlebook24.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/googlebook24.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: Sandbox/luciano/kirbi/src/kirbi/static/master.css
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/static/master.css 2007-08-07 02:06:51 UTC (rev 78651)
+++ Sandbox/luciano/kirbi/src/kirbi/static/master.css 2007-08-07 04:00:34 UTC (rev 78652)
@@ -14,6 +14,10 @@
text-decoration: underline;
}
+a img {
+ border: none;
+}
+
div.top {
background-color: #6060a8;
width: 100%;
@@ -97,6 +101,16 @@
padding-right: 5px;
}
+.isbn_list th {
+ text-align: center;
+ padding-left: 5px;
+}
+
+.isbn_list td {
+ text-align: center;
+ padding-left: 5px;
+}
+
.unknown {
color: gray;
}
Added: Sandbox/luciano/kirbi/src/kirbi/static/worldcat16.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/worldcat16.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Sandbox/luciano/kirbi/src/kirbi/static/worldcat24.gif
===================================================================
(Binary files differ)
Property changes on: Sandbox/luciano/kirbi/src/kirbi/static/worldcat24.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Checkins
mailing list