fclient-commit Mailing List for fclient (Page 23)
Status: Pre-Alpha
Brought to you by:
jurner
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(17) |
Feb
(209) |
Mar
(63) |
Apr
(31) |
May
(7) |
Jun
(39) |
Jul
(390) |
Aug
(122) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
From: <jU...@us...> - 2008-06-28 08:38:40
|
Revision: 412 http://fclient.svn.sourceforge.net/fclient/?rev=412&view=rev Author: jUrner Date: 2008-06-28 01:38:50 -0700 (Sat, 28 Jun 2008) Log Message: ----------- some notes on PutComplexDir vs PutDiskDir Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-06-28 08:37:59 UTC (rev 411) +++ trunk/sandbox/fcp2/client.py 2008-06-28 08:38:50 UTC (rev 412) @@ -182,10 +182,10 @@ # TODO: check if this is a bug in Fcp # NOTE: seems to be fixed in [build 1112], fixes removed #------------------------------------------------------------------------------------------------------------------------------------------------- -# PutComplexDir +# PersistentPutDiskDir vs PutComplexDir # -# x. currently not handled on PersistentPut. have to test this -# +# x. currently not handled on PersistentPutDir. have to test this +# Fcp provides a new field "PutDirType": "complex" or "disk" to distinguish PutComplexDir and PutDiskDir # #------------------------------------------------------------------------------------------------------------------------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 08:37:50
|
Revision: 411 http://fclient.svn.sourceforge.net/fclient/?rev=411&view=rev Author: jUrner Date: 2008-06-28 01:37:59 -0700 (Sat, 28 Jun 2008) Log Message: ----------- no longer needed Removed Paths: ------------- trunk/sandbox/fcp2/scripts/fcpscripts_consts.py Deleted: trunk/sandbox/fcp2/scripts/fcpscripts_consts.py =================================================================== --- trunk/sandbox/fcp2/scripts/fcpscripts_consts.py 2008-06-28 08:23:07 UTC (rev 410) +++ trunk/sandbox/fcp2/scripts/fcpscripts_consts.py 2008-06-28 08:37:59 UTC (rev 411) @@ -1,29 +0,0 @@ -"""Some consts for scripts""" - -import os -#************************************************************************** -# -#************************************************************************** -FcpDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -DocDir = os.path.join(FcpDir, 'doc') -EpydocFolder = 'epydoc' -EpydocDir = os.path.join(DocDir, EpydocFolder) - -FilenameMessageCheatSheet = 'MessageCheatSheet.html' - -WikiBaseUri = 'http://wiki.freenetproject.org/' -WikiStartPage = WikiBaseUri + 'FreenetFCPSpec2Point0' -WikiFcpPrefix = 'FCP2p0' - -#************************************************************************** -# some helpers -#************************************************************************** -def saveCreateDir(directory): - if not os.path.isdir(directory): - os.mkdir(directory) - -def enshureDocDirExists(): - saveCreateDir(DocDir) - saveCreateDir(EpydocDir) - - \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 08:23:07
|
Revision: 410 http://fclient.svn.sourceforge.net/fclient/?rev=410&view=rev Author: jUrner Date: 2008-06-28 01:23:07 -0700 (Sat, 28 Jun 2008) Log Message: ----------- new standalone version Modified Paths: -------------- trunk/sandbox/fcp2/scripts/gen_messagecheatsheet.py Modified: trunk/sandbox/fcp2/scripts/gen_messagecheatsheet.py =================================================================== --- trunk/sandbox/fcp2/scripts/gen_messagecheatsheet.py 2008-06-28 08:23:00 UTC (rev 409) +++ trunk/sandbox/fcp2/scripts/gen_messagecheatsheet.py 2008-06-28 08:23:07 UTC (rev 410) @@ -1,4 +1,4 @@ -"""Dumps a cheatsheet for all Fcp messages as taken from the freenet wiki to 'MessageCheatSheet.html' +"""Dumps a cheatsheet for all Fcp messages as taken from the freenet wiki to 'MessageCheatSheet.html' in the current folder gen_cheatsheet.py [path-to-tidy-executable] @@ -22,27 +22,20 @@ import subprocess import urllib from xml.etree import cElementTree as ET +#******************************************************************************* +# consts +#******************************************************************************* +Dir = os.path.dirname(os.path.abspath(__file__)) -#--> rel import hack -class _RelImportHack(object): - def __init__(self, n): - fpath = os.path.abspath(__file__) - for i in xrange(n): fpath = os.path.dirname(fpath) - sys.path.insert(0, fpath) - def __del__(self): sys.path.pop(0) -hack = _RelImportHack(3) +FilenameMessageCheatSheet = 'MessageCheatSheet.html' -from fcp2.scripts import fcpscripts_consts as consts +WikiBaseUri = 'http://wiki.freenetproject.org/' +WikiStartPage = WikiBaseUri + 'FreenetFCPSpec2Point0' +WikiFcpPrefix = 'FCP2p0' - -del hack -#<-- rel import hack #******************************************************************************* # #******************************************************************************* -Dir = os.path.dirname(os.path.abspath(__file__)) - - #TODO: does shell=True work on windows? UseShell = True @@ -90,7 +83,7 @@ TidyToHtml = '%s --input-xml --output-html yes --indent yes --show-warnings no' % tidy buf = cStringIO.StringIO() - tree = readPage(consts.WikiStartPage, TidyToXml) + tree = readPage(WikiStartPage, TidyToXml) tables = tree.findall('.//table') if tables: @@ -105,7 +98,7 @@ hrefMessage = a.attrib.get('href', None) if hrefMessage is not None: - uri = consts.WikiBaseUri + hrefMessage + uri = WikiBaseUri + hrefMessage tree = readPage(uri, TidyToXml) # find <div class="page"> @@ -135,7 +128,7 @@ del a.attrib['href'] # place an anchor to message name and some deco - a = ET.Element('a', {'name': hrefMessage.replace(consts.WikiFcpPrefix, '')}) + a = ET.Element('a', {'name': hrefMessage.replace(WikiFcpPrefix, '')}) div.insert(0, a) hr = ET.Element('hr') div.append(hr) @@ -143,14 +136,14 @@ tree = ET.ElementTree(div) tree.write(buf) # - fpathCheatSheet = os.path.join(Dir, consts.FilenameMessageCheatSheet) + fpathCheatSheet = os.path.join(Dir, FilenameMessageCheatSheet) with open(fpathCheatSheet, 'w') as fp: fp.write(tidyPage(buf.getvalue(), TidyToHtml) ) return fpathCheatSheet def main(tidy=None): - print 'generating message cheat sheet from: %s' % consts.WikiStartPage + print 'generating message cheat sheet from: %s' % WikiStartPage fpath = createCheatSheet(tidy) print 'done' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 08:22:51
|
Revision: 409 http://fclient.svn.sourceforge.net/fclient/?rev=409&view=rev Author: jUrner Date: 2008-06-28 01:23:00 -0700 (Sat, 28 Jun 2008) Log Message: ----------- new standalone version Modified Paths: -------------- trunk/sandbox/fcp2/scripts/gen_docs.py Modified: trunk/sandbox/fcp2/scripts/gen_docs.py =================================================================== --- trunk/sandbox/fcp2/scripts/gen_docs.py 2008-06-28 08:14:41 UTC (rev 408) +++ trunk/sandbox/fcp2/scripts/gen_docs.py 2008-06-28 08:23:00 UTC (rev 409) @@ -1,61 +1,75 @@ -"""Generates epydoc documentation for the package +"""Generates epydoc documentation for the package in --> packageDir/doc gen_docs.py -@note: the script assumes it is located in the scripts subdirectory of the fcp package +@note: the script assumes it is located in the <doc> or any other emidiate subdirectory of the package @note: Use gen_docs.py -? or --help to print out this help text + +@requires: epydoc """ -from __future__ import with_statement - import sys, os from epydoc import cli import subprocess +#************************************************************************************ +# consts +#************************************************************************************ +PACKAGE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +DOC_DIR = os.path.join(PACKAGE_DIR, 'doc') +EPYDOC_FOLDER = 'epydoc' +EPYDOC_DIR = os.path.join(DOC_DIR, EPYDOC_FOLDER) -#--> rel import hack -class _RelImportHack(object): - def __init__(self, n): - fpath = os.path.abspath(__file__) - for i in xrange(n): fpath = os.path.dirname(fpath) - sys.path.insert(0, fpath) - def __del__(self): sys.path.pop(0) -hack = _RelImportHack(3) +#************************************************************************************ +# helpers +#************************************************************************************ +def save_create_dir(directory): + """creates a directory if it does not exist already""" + if not os.path.isdir(directory): + os.makedirs(directory) + +def enshure_doc_dir_dxists(): + """enshures epydoc docdir exists""" + save_create_dir(EPYDOC_DIR) + +def pprint(msg, *params): + """helper to pprint user feedback""" + print '>' + msg + for i in params: + print ' ' + i -from fcp2.scripts import fcpscripts_consts as consts - - -del hack -#<-- rel import hack -#************************************************************************************** -# -#************************************************************************************** +#************************************************************************** +# +#************************************************************************** def main(): """""" - - consts.enshureDocDirExists() - print 'calling epydoc' + pprint('dumping docs to:', EPYDOC_DIR) + enshure_doc_dir_dxists() + pprint('calling epydoc') sys.argv = [ __file__, '-v', - '-o%s' % consts.EpydocDir, + '-o%s' % EPYDOC_DIR, '--src-code-tab-width', '4', #'--debug', - consts.FcpDir, + PACKAGE_DIR, ] cli.cli() - print 'ok' - + # create a redirect to 'epydoc/index.html' - print 'creating redirect' - with open(os.path.join(consts.DocDir, 'index.html'), 'w') as fp: + html_index = os.path.join(DOC_DIR, 'index.html') + pprint('creating redirect:', html_index) + fp = open(html_index, 'w') + try: fp.write('''<html> <head> <meta http-equiv="Refresh" content="0; URL=%s"> </head> </html> -''' % (consts.EpydocFolder + '/' + 'index.html') ) +''' % (EPYDOC_FOLDER + '/' + 'index.html') ) + finally: + fp.close() - print 'done' + pprint('done') #************************************************************************************** # @@ -64,8 +78,4 @@ wantsHelp = len(sys.argv) > 1 and sys.argv[1] or None if wantsHelp not in ('-?', '--help'): sys.exit(main()) - print __doc__ - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 08:14:32
|
Revision: 408 http://fclient.svn.sourceforge.net/fclient/?rev=408&view=rev Author: jUrner Date: 2008-06-28 01:14:41 -0700 (Sat, 28 Jun 2008) Log Message: ----------- asdded a test to check if ClientDisconnected() is triggered when the client is already closed Modified Paths: -------------- trunk/sandbox/fcp2/test_fcp/test_client.py Modified: trunk/sandbox/fcp2/test_fcp/test_client.py =================================================================== --- trunk/sandbox/fcp2/test_fcp/test_client.py 2008-06-28 08:13:38 UTC (rev 407) +++ trunk/sandbox/fcp2/test_fcp/test_client.py 2008-06-28 08:14:41 UTC (rev 408) @@ -324,7 +324,8 @@ #*********************************************************************************** class Test_close(BaseTestClient): - def test_close(self): + #NOTE: currently ClientDisconnected() is triggered even if the client was not connected + def test_close_disconnected_client(self): self.client.close() self.assertHasNextEvent( self.client.events.ClientDisconnected, @@ -332,7 +333,17 @@ ('DisconnectReason', consts.DisconnectReason.Close), ) + def test_close_connected_client(self): + self.connectClient() + self.client.close() + self.assertHasNextEvent( + self.client.events.ClientDisconnected, + consts.Message.ClientDisconnected, + ('DisconnectReason', consts.DisconnectReason.Close), + ) + + #*********************************************************************************** # #*********************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 08:13:29
|
Revision: 407 http://fclient.svn.sourceforge.net/fclient/?rev=407&view=rev Author: jUrner Date: 2008-06-28 01:13:38 -0700 (Sat, 28 Jun 2008) Log Message: ----------- ClientDisconnected() was not triggered when the client was already closed. fixed Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-06-28 07:58:02 UTC (rev 406) +++ trunk/sandbox/fcp2/client.py 2008-06-28 08:13:38 UTC (rev 407) @@ -295,6 +295,8 @@ @param msg: message to pass to the ClientDisconnected event or None to not inform listeners @todo: complain if the client is already closed? + @todo: trigger ClientDisconnected() if the client is already closed? should be yes. otherwise + we'd have to distinguish between intentional and unintentional closing like on a broken io """ consts.Logger.Client.info(consts.LogMessages.Closing) @@ -306,12 +308,11 @@ self._ddaTests = [] self._requests = {} - #TODO: complain if we are already closed? + if msg is not None: + self.events.ClientDisconnected(msg) if self.ioHandler.isOpen(): self.ioHandler.close() - if msg is not None: - self.events.ClientDisconnected(msg) - + #TODO: check if this method is still needed def _finalizeRequest(self, msg, request, event): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-06-28 07:57:56
|
Revision: 406 http://fclient.svn.sourceforge.net/fclient/?rev=406&view=rev Author: jUrner Date: 2008-06-28 00:58:02 -0700 (Sat, 28 Jun 2008) Log Message: ----------- bug #0001965 got fixed. remove fix from client Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-05-05 11:29:14 UTC (rev 405) +++ trunk/sandbox/fcp2/client.py 2008-06-28 07:58:02 UTC (rev 406) @@ -103,13 +103,6 @@ # minor one # #FIX: None -#------------------------------------------------------------------------------------------------------------------------------------------------ -# [0001965: Persistence vs PersistenceType] -# -# PersistentGet passes persistence field as "PersistenceType", PersistentPut as "Persistence" -# already fixed this here in the client -# -# FIX: implemented in client #------------------------------------------------------------------------------------------------------------------------------------------------- # [0002015: Drop the global queue] # @@ -913,9 +906,6 @@ #FIX: remove Started param from PersistentGet / Put if 'Started' in initialRequest.params: del initialRequest.params['Started'] - #FIX: [0001965: Persistence vs PersistenceType] - if 'PersistenceType' in initialRequest.params: - initialRequest['Persistence'] = initialRequest.params.pop('PersistenceType') initialRequest['RequestStatus'] |= consts.RequestStatus.Restored self.events.RequestRestored(initialRequest) return True This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 11:29:09
|
Revision: 405 http://fclient.svn.sourceforge.net/fclient/?rev=405&view=rev Author: jUrner Date: 2008-05-05 04:29:14 -0700 (Mon, 05 May 2008) Log Message: ----------- a few more notes Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-05-05 11:18:52 UTC (rev 404) +++ trunk/sandbox/fcp2/client.py 2008-05-05 11:29:14 UTC (rev 405) @@ -143,10 +143,15 @@ # removbe request is now handled uniformly in Fcp. modify request not yet. # #------------------------------------------------------------------------------------------------------------------------------------------------- +# [0002202: drop global persistents ] +# +# suggested dropping of global persistents. pretty dangerous and unhandy imo. +# +# +#-------------------------------------------------------------------------------------------------------------------------------------------------- - # Todos #------------------------------------------------------------------------------------------------------------------------------------------------ # clean up @@ -2127,7 +2132,8 @@ raise ValueError('Can not modify request: %s' % initialRequest.name) #FIX: [0002083] - # no way to change priority here ..this is simply not implemented in the protocol + # no way to change priority for non-persistent requests..this is simply not implemented in the protocol + # persistentUserData is ok, priority can not be changed. no idea how to handle this. if initialRequest['Persistence'] == consts.Persistence.Connection: modified = {} #if priorityClass is not None: @@ -2141,6 +2147,7 @@ initialRequest['Modified'] = modified self.events.RequestModified(initialRequest) return + #/FIX: [0002083] msg = message.ModifyPersistentRequest( Identifier=initialRequest['Identifier'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 11:18:49
|
Revision: 404 http://fclient.svn.sourceforge.net/fclient/?rev=404&view=rev Author: jUrner Date: 2008-05-05 04:18:52 -0700 (Mon, 05 May 2008) Log Message: ----------- typos Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-05-05 11:18:18 UTC (rev 403) +++ trunk/sandbox/fcp2/client.py 2008-05-05 11:18:52 UTC (rev 404) @@ -853,7 +853,7 @@ code = msg['Code'] if code == consts.FetchError.Canceled: - initialRequest['RequestStatus'] |= onsts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue + initialRequest['RequestStatus'] |= consts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue del self._requests[requestIdentifier] self.events.RequestRemoved(initialRequest) return True @@ -984,7 +984,7 @@ code = msg['Code'] if code == consts.InsertError.Canceled: - initialRequest['RequestStatus'] |= onsts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue + initialRequest['RequestStatus'] |= consts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue del self._requests[requestIdentifier] self.events.RequestRemoved(initialRequest) return True This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 11:18:25
|
Revision: 403 http://fclient.svn.sourceforge.net/fclient/?rev=403&view=rev Author: jUrner Date: 2008-05-05 04:18:18 -0700 (Mon, 05 May 2008) Log Message: ----------- got two close events (atexit triggered the sdecond). fixed Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-05-05 08:00:40 UTC (rev 402) +++ trunk/sandbox/fcp2/client.py 2008-05-05 11:18:18 UTC (rev 403) @@ -308,10 +308,11 @@ self._ddaTests = [] self._requests = {} + #TODO: complain if we are already closed? if self.ioHandler.isOpen(): self.ioHandler.close() - if msg is not None: - self.events.ClientDisconnected(msg) + if msg is not None: + self.events.ClientDisconnected(msg) #TODO: check if this method is still needed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 08:00:39
|
Revision: 402 http://fclient.svn.sourceforge.net/fclient/?rev=402&view=rev Author: jUrner Date: 2008-05-05 01:00:40 -0700 (Mon, 05 May 2008) Log Message: ----------- RemovePersistentRequest is deprecated in Fcp. use RemoveRequest Modified Paths: -------------- trunk/sandbox/fcp2/message.py Modified: trunk/sandbox/fcp2/message.py =================================================================== --- trunk/sandbox/fcp2/message.py 2008-05-05 07:59:34 UTC (rev 401) +++ trunk/sandbox/fcp2/message.py 2008-05-05 08:00:40 UTC (rev 402) @@ -1240,8 +1240,8 @@ } -class RemovePersistentRequest(MessageBase): - name = consts.Message.RemovePersistentRequest +class RemoveRequest(MessageBase): + name = consts.Message.RemoveRequest _additional_params_ = {} _param_types_ = { 'Global': types.FcpTypeBool, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 07:59:29
|
Revision: 401 http://fclient.svn.sourceforge.net/fclient/?rev=401&view=rev Author: jUrner Date: 2008-05-05 00:59:34 -0700 (Mon, 05 May 2008) Log Message: ----------- adjusted debug level Modified Paths: -------------- trunk/sandbox/fcp2/iohandler.py Modified: trunk/sandbox/fcp2/iohandler.py =================================================================== --- trunk/sandbox/fcp2/iohandler.py 2008-05-05 07:58:55 UTC (rev 400) +++ trunk/sandbox/fcp2/iohandler.py 2008-05-05 07:59:34 UTC (rev 401) @@ -125,7 +125,7 @@ if p == '': raise socket.error('Socket closed by host') except socket.timeout, details: - raise consts.IOTimeoutError(details, consts.Logger.IO.error) + raise consts.IOTimeoutError(details, consts.Logger.IO.debug) except socket.error, details: self.close() raise consts.IOBrokenError(details, consts.Logger.IO.error) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 07:58:51
|
Revision: 400 http://fclient.svn.sourceforge.net/fclient/?rev=400&view=rev Author: jUrner Date: 2008-05-05 00:58:55 -0700 (Mon, 05 May 2008) Log Message: ----------- RemovePersistentRequest is deprecated in Fcp. use RemoveRequest instead. ++ fixes for exceptions Modified Paths: -------------- trunk/sandbox/fcp2/consts.py Modified: trunk/sandbox/fcp2/consts.py =================================================================== --- trunk/sandbox/fcp2/consts.py 2008-05-05 07:57:16 UTC (rev 399) +++ trunk/sandbox/fcp2/consts.py 2008-05-05 07:58:55 UTC (rev 400) @@ -11,7 +11,7 @@ """Exception raised when a message could not be parsed succesfuly""" def __init__(self, message, logMethod=None): if logMethod is not None: - logMethod(self.__class__.__name__ + message) + logMethod(self.__class__.__name__ + ': %s' % message) Exception.__init__(self, message) @@ -19,7 +19,7 @@ """Exception raised if the object can not be connected""" def __init__(self, message, logMethod=None): if logMethod is not None: - logMethod(self.__class__.__name__ + message) + logMethod(self.__class__.__name__ + ': %s' % message) Exception.__init__(self, message) @@ -27,7 +27,7 @@ """Exception raised if the object is closed""" def __init__(self, message, logMethod=None): if logMethod is not None: - logMethod(self.__class__.__name__ + message) + logMethod(self.__class__.__name__ + ': %s' % message) Exception.__init__(self, message) @@ -35,7 +35,7 @@ """Exception raised if the IO connection is broken""" def __init__(self, message, logMethod=None): if logMethod is not None: - logMethod(self.__class__.__name__ + message) + logMethod(self.__class__.__name__ + ': %s' % message) Exception.__init__(self, message) @@ -43,7 +43,7 @@ """Exception raised when the io connection is closed""" def __init__(self, message, logMethod=None): if logMethod is not None: - logMethod(self.__class__.__name__ + message) + logMethod(self.__class__.__name__ + ': %s' % message) Exception.__init__(self, message) #************************************************************************ @@ -348,7 +348,7 @@ ModifyPeerNote = 'ModifyPeerNote' ModifyPersistentRequest = 'ModifyPersistentRequest' RemovePeer = 'RemovePeer' - RemovePersistentRequest = 'RemovePersistentRequest' + RemoveRequest = 'RemoveRequest' Shutdown = 'Shutdown' SubscribeUSK = 'SubscribeUSK' TestDDARequest = 'TestDDARequest' # (since 1027) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-05-05 07:57:18
|
Revision: 399 http://fclient.svn.sourceforge.net/fclient/?rev=399&view=rev Author: jUrner Date: 2008-05-05 00:57:16 -0700 (Mon, 05 May 2008) Log Message: ----------- Fcp now allows to remove non-persistent requests. adapt Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-04-09 21:46:27 UTC (rev 398) +++ trunk/sandbox/fcp2/client.py 2008-05-05 07:57:16 UTC (rev 399) @@ -138,8 +138,15 @@ # #FIX: workaround for the "related" part #------------------------------------------------------------------------------------------------------------------------------------------------ - + # [0002200 - handle persistent and non-peristent request uniformly] +# +# removbe request is now handled uniformly in Fcp. modify request not yet. +# +#------------------------------------------------------------------------------------------------------------------------------------------------- + + + # Todos #------------------------------------------------------------------------------------------------------------------------------------------------ # clean up @@ -307,6 +314,7 @@ self.events.ClientDisconnected(msg) + #TODO: check if this method is still needed def _finalizeRequest(self, msg, request, event): """Finalzes a request @param msg: message that is the reason for finalizing @@ -320,7 +328,7 @@ that the request has been completed and remove it fom our queue if necessary. Non Get / Put requests will be removed in any case. """ - removeRequest = msg == message.ProtocolError or msg == message.PersistentRequestRemoved + removeRequest = msg == message.ProtocolError or msg == message.PersistentRequestRemoved # TODO: PersistentRequestRemoved??? if not removeRequest: #NOTE: non Get / Put related requests do not have a Persistence param removeRequest = request.params.get('Persistence', consts.Persistence.Connection) == consts.Persistence.Connection @@ -844,7 +852,10 @@ code = msg['Code'] if code == consts.FetchError.Canceled: - return False + initialRequest['RequestStatus'] |= onsts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue + del self._requests[requestIdentifier] + self.events.RequestRemoved(initialRequest) + return True # check if it is one of our requests for key information if code == consts.FetchError.TooBig and initialRequest['RequestType'] == consts.RequestType.GetKeyInfo: @@ -941,13 +952,15 @@ return True - elif msg == message.PersistentRequestRemoved: - if initialRequest is None: - return False + # don't handle PersistentRequestRemoved. instead we handle it in Get/PutFailed + # + #elif msg == message.PersistentRequestRemoved: + # if initialRequest is None: + # return False - initialRequest['RequestStatus'] |= consts.RequestStatus.Removed - self._finalizeRequest(msg, initialRequest, self.events.RequestRemoved) - return True + # initialRequest['RequestStatus'] |= consts.RequestStatus.Removed + # self._finalizeRequest(msg, initialRequest, self.events.RequestRemoved) + # return True elif msg == message.SimpleProgress: @@ -970,7 +983,10 @@ code = msg['Code'] if code == consts.InsertError.Canceled: - return False + initialRequest['RequestStatus'] |= onsts.RequestStatus.Removed | consts.RequestStatus.Completed | consts.RequestStatus.RemovedFromQueue + del self._requests[requestIdentifier] + self.events.RequestRemoved(initialRequest) + return True initialRequest['RequestStatus'] |= consts.RequestStatus.Error initialRequest['ErrorMessage'] = msg @@ -2145,22 +2161,15 @@ initialRequest = self._requests[requestIdentifier] initialRequest['RequestStatus'] |= consts.RequestStatus.Removed | consts.RequestStatus.Completed if initialRequest['RequestType'] & (consts.RequestType.MaskGet | consts.RequestType.MaskPut): - - # remove Persistence.Connection emidiately - # ..make up a PersistentRequestRemoved message for this case - if initialRequest['Persistence'] == consts.Persistence.Connection: - msg = message.PersistentRequestRemoved(Identifier=requestIdentifier, Global=False) - self._finalizeRequest(msg, initialRequest, self.events.RequestRemoved) - else: - self.sendMessage( - message.RemovePersistentRequest( + self.sendMessage( + message.RemoveRequest( Global=False, Identifier=requestIdentifier, ) - ) + ) else: del self._requests[requestIdentifier] - + def resendRequest(self, request): """Resends a request This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 22:33:52
|
Revision: 398 http://fclient.svn.sourceforge.net/fclient/?rev=398&view=rev Author: jUrner Date: 2008-04-09 14:46:27 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed docs Modified Paths: -------------- trunk/sandbox/fcp2/types.py Modified: trunk/sandbox/fcp2/types.py =================================================================== --- trunk/sandbox/fcp2/types.py 2008-04-09 21:46:20 UTC (rev 397) +++ trunk/sandbox/fcp2/types.py 2008-04-09 21:46:27 UTC (rev 398) @@ -130,7 +130,7 @@ class FcpTypeTimeDelta(FcpType): """Time durations passed as tuple((int) number, modifier). - For modifiers see : L{consts.TimeDurationPostfix}. Number can be -1 + For modifiers see : L{consts.TimeDeltaPostfix}. Number can be -1 aswell, meaniong 'not set' or 'undefined'. >>> FcpTypeTimeDelta.fcpToPython('1000day') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 22:33:34
|
Revision: 397 http://fclient.svn.sourceforge.net/fclient/?rev=397&view=rev Author: jUrner Date: 2008-04-09 14:46:20 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed docs Modified Paths: -------------- trunk/sandbox/fcp2/iohandler.py Modified: trunk/sandbox/fcp2/iohandler.py =================================================================== --- trunk/sandbox/fcp2/iohandler.py 2008-04-09 21:46:05 UTC (rev 396) +++ trunk/sandbox/fcp2/iohandler.py 2008-04-09 21:46:20 UTC (rev 397) @@ -48,7 +48,7 @@ @param kwargs: any additional keyword arguments passed to L{IOHandler.connect} @return: always None - @raise L{IOConnectFailed}: in case something goes wrong + @raise L{consts.IOConnectFailedError}: in case something goes wrong """ raise consts.IOConnectFailedError('Failed', consts.Logger.IO.error) @@ -167,7 +167,7 @@ def __init__(self, ioPrototype=SocketIO): """ - @paran ioPrototype: (L{IOObjectBase}) derrived class to handle message io + @param ioPrototype: (L{IOObjectBase}) derrived class to handle message io """ self._ioPrototype = ioPrototype self._receiveBuffer = '' @@ -327,7 +327,7 @@ """Sends a message to freenet @param msg: (Message) message to send @return: Message - @raise L{IOBroken}: if the connection to the io dies unexpectedly + @raise L{consts.IOBrokenError}: if the connection to the io dies unexpectedly """ consts.Logger.IOHandler.debug(consts.LogMessages.Sending + msg.pprint()) self.io.write(msg.toString()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:57:45
|
Revision: 396 http://fclient.svn.sourceforge.net/fclient/?rev=396&view=rev Author: jUrner Date: 2008-04-09 14:46:05 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed docs Modified Paths: -------------- trunk/sandbox/fcp2/fcp_lib/pmstruct.py Modified: trunk/sandbox/fcp2/fcp_lib/pmstruct.py =================================================================== --- trunk/sandbox/fcp2/fcp_lib/pmstruct.py 2008-04-09 21:45:55 UTC (rev 395) +++ trunk/sandbox/fcp2/fcp_lib/pmstruct.py 2008-04-09 21:46:05 UTC (rev 396) @@ -122,15 +122,6 @@ raise ValueError('Invalid field "%s": (%s)' % (fieldName, details)) return klass._sep_.join(out) - -""" -class PersistentParams(PoorMansStruct): - _fields_ = [ - ('Flags', PoorMansStruct.Int), - ('InitTime', PoorMansStruct.Float), - ('PerisitstentUserData', PoorMansStruct.Str), - ] -""" #**************************************************************************** # #**************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:54:46
|
Revision: 394 http://fclient.svn.sourceforge.net/fclient/?rev=394&view=rev Author: jUrner Date: 2008-04-09 14:45:27 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed docs Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-04-09 21:26:57 UTC (rev 393) +++ trunk/sandbox/fcp2/client.py 2008-04-09 21:45:27 UTC (rev 394) @@ -1390,11 +1390,9 @@ @return: (str) request identifier - @event: (L{events.Event.RequestCompleted}) triggered when the request is complete - @event: (L{events.Event.RequestFailed}) triggered when the request failes - @event: (L{events.Event.RequestFetchable}) triggered as soon as the request is fetchable - @event: (L{events.Event.RequestCompressing}) triggered when the request is about to be compressed - @event: (L{events.Event.RequestCompressed}) triggered as soon as compressing of the request is completed + @event: (L{events.Events.RequestCompleted}) triggered when the request is complete + @event: (L{events.Events.RequestFailed}) triggered when the request failes + @event: (L{events.Events.RequestFetchable}) triggered as soon as the request is fetchable filename changes or the request is modified otherwise (see L{modifyRequest}) @@ -1745,20 +1743,20 @@ @param dontCompress: (bool) if True, the node won't try to compress the data @param maxRetries: (int) maximum number of retries or -1 to retry forver or None to leave it to the node to decide @param priorityClass: (L{consts.Priority}) priority of the request - @paramtargetFilename: (str) filename to append to the key (may not contain slashes) + @param targetFilename: (str) filename to append to the key (may not contain slashes) @param userData: any non persistent data to associate to the request @param persistentUserData: any string to associate to the request as persistent data - @event: (L{events.Event.RequestCompleted}) triggered when the request is complete - @event: (L{events.Event.RequestFailed}) triggered when the request failes - @event: (L{events.Event.RequestFetchable}) triggered as soon as the request is fetchable - @event: (L{events.Event.RequestCompressing}) triggered when the request is about to be compressed - @event: (L{events.Event.RequestCompressed}) triggered as soon as compressing of the request is completed + @event: (L{events.Events.RequestCompleted}) triggered when the request is complete + @event: (L{events.Events.RequestFailed}) triggered when the request failes + @event: (L{events.Events.RequestFetchable}) triggered as soon as the request is fetchable + @event: (L{events.Events.RequestCompressionStarted}) triggered when the request is about to be compressed + @event: (L{events.Events.RequestCompressionComopleted}) triggered as soon as compressing of the request is completed @note: if the upload is successful the node will create a L{consts.KeyType.CHK} key under wich the data can be retreieved. The key can be accessed as 'URI' member of the request as soon - as the L{events.Event.RequestFetchable} or the L{events.Event.RequestCompleted} event + as the L{events.Events.RequestFetchable} or the L{events.Events.RequestCompleted} event is triggered. @todo: EarlyEncode and GetCHKOnly message params not implemented @@ -1972,7 +1970,7 @@ """Uploads data that can be updated by the owner @param data: (bytes) data to upload - @params privateKey: see: private key as generated by L{generateKeypair} + '/' + name + @param privateKey: see: private key as generated by L{generateKeypair} + '/' + name @note: for other params see L{chkPutData} @note: use this method to upload updatable data. First you need to create a public / private @@ -2369,7 +2367,7 @@ @note: the client does not keep track of messages send to a plugin, because the plugin may or may not return. If the plugin sends a reply, a L{events.PluginMessage} is triggered. - If something goes wrong, L{events.ProtocolError} or an is L{events.IdentifierCollision} + If something goes wrong, L{events.Events.ProtocolError} or an is L{events.Events.IdentifierCollision} is triggered. Use the identifier passed to identify responses. @todo: this is method not tested. Assumption: identifer does not have to be unique to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:46:10
|
Revision: 395 http://fclient.svn.sourceforge.net/fclient/?rev=395&view=rev Author: jUrner Date: 2008-04-09 14:45:55 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed docs Modified Paths: -------------- trunk/sandbox/fcp2/fcp_lib/node.py Modified: trunk/sandbox/fcp2/fcp_lib/node.py =================================================================== --- trunk/sandbox/fcp2/fcp_lib/node.py 2008-04-09 21:45:27 UTC (rev 394) +++ trunk/sandbox/fcp2/fcp_lib/node.py 2008-04-09 21:45:55 UTC (rev 395) @@ -93,14 +93,14 @@ def getDefaultValue(self, node): """Returns the default value of a node when a new node is about to be created - @paran node: the new node to query the default value for + @param node: the new node to query the default value for @note: the default implementation returns None. Overwrite to customize """ return None def select(self, path): """Selects node according to a path pattern - @patram path: (str) path pattern + @param path: (str) path pattern @return: (list) of matching nodes @note: the pattern supported is pretty simplistic. It may contain wildcards to select any node 'key.*.other' or a double wildcard to recursively select all This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:27:03
|
Revision: 393 http://fclient.svn.sourceforge.net/fclient/?rev=393&view=rev Author: jUrner Date: 2008-04-09 14:26:57 -0700 (Wed, 09 Apr 2008) Log Message: ----------- looks like fiename part is optional in SSKs Modified Paths: -------------- trunk/sandbox/fcp2/key.py Modified: trunk/sandbox/fcp2/key.py =================================================================== --- trunk/sandbox/fcp2/key.py 2008-04-09 21:09:58 UTC (rev 392) +++ trunk/sandbox/fcp2/key.py 2008-04-09 21:26:57 UTC (rev 393) @@ -184,8 +184,10 @@ (?P<cryptoKey>[a-z0-9\-~]{43}), (?P<extra>[a-z0-9\-~]{7}) ) - (?: / (?P<filename>[^/]+?)) - (?: /)? + ( + (?: / (?P<filename>[^/]+?)) + (?: /)? + )? ''' KeyType = consts.KeyType.SSK KeyPattern = re.compile(_key_pattern_, re.I | re.X) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:09:54
|
Revision: 392 http://fclient.svn.sourceforge.net/fclient/?rev=392&view=rev Author: jUrner Date: 2008-04-09 14:09:58 -0700 (Wed, 09 Apr 2008) Log Message: ----------- add node tree to deal with hirarchical message params Modified Paths: -------------- trunk/sandbox/fcp2/message.py Modified: trunk/sandbox/fcp2/message.py =================================================================== --- trunk/sandbox/fcp2/message.py 2008-04-09 21:09:48 UTC (rev 391) +++ trunk/sandbox/fcp2/message.py 2008-04-09 21:09:58 UTC (rev 392) @@ -17,6 +17,7 @@ from fcp2 import consts from fcp2 import types from fcp2.fcp_lib import pmstruct +from fcp2.fcp_lib import node from fcp2.fcp_lib import uuid @@ -25,6 +26,13 @@ #******************************************************************************** # #******************************************************************************** +class Node(node.Node): + """Node tree used along with messages""" + ComponentSep = '.' + +#******************************************************************************** +# +#******************************************************************************** class PrivateParam(str): """Helper class to mark a message parameter as PrivateParam to the package""" @@ -146,6 +154,18 @@ return '\n'.join(out) + def toTree(self): + """Converts message params to a tree of nodes + @return: (L{Node}) root node + + @note: some messages have hirarchicaly organized (dotted) parameters. Use this + method to convert the parameters to a tree of nodes + """ + node_ = Node() + for name, value in self.params.iteritems(): + node_[name] = value + + def updatePersistentParams(self): pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 21:09:44
|
Revision: 391 http://fclient.svn.sourceforge.net/fclient/?rev=391&view=rev Author: jUrner Date: 2008-04-09 14:09:48 -0700 (Wed, 09 Apr 2008) Log Message: ----------- add node tree to deal with hirarchical message params Added Paths: ----------- trunk/sandbox/fcp2/fcp_lib/node.py Added: trunk/sandbox/fcp2/fcp_lib/node.py =================================================================== --- trunk/sandbox/fcp2/fcp_lib/node.py (rev 0) +++ trunk/sandbox/fcp2/fcp_lib/node.py 2008-04-09 21:09:48 UTC (rev 391) @@ -0,0 +1,174 @@ +"""Nodes and trees""" + + +#*********************************************************************** +# +#*********************************************************************** +class Node(object): + """Simple node tree implementation + + @cvar ComponentSep: (str) separator to be used for keys + + @ivar children: (dict) name --> node of child nodes + @ivar key: (str) key of the node + @ivar name: (str) name of the node (take care that this is None for root nodes) + @ivar parent: (Node) parent node of the node (take care that this is None for root nodes) + @ivar value: (any) value contained by the node + + >>> node = Node() + + # for the root of the name and parent is always None + >>> node.name + + # to populate the tree with nodes, assign a value to the desired key. + # All intermediate nodes will be created automatically + >>> node['foo/bar/baz'] = 1234 + >>> node['foo/bar/baz'].value + 1234 + + >>> node['foo'].value + + """ + __slots__ = ('children', 'name', 'parent', 'value') + + ComponentSep = '/' + + def __init__(self): + """Creates a new root node""" + + self.children = {} + self.name = None + self.parent = None + self.value = None + + def _get_key(self): + out = [] + node = self + while node.name is not None: + out.append(node.name) + node = node.parent + out.reverse() + return self.ComponentSep.join(out) + + key = property(_get_key, None, None) + + + def __getitem__(self, key): + """Returns the node located at key""" + L = key.split(self.ComponentSep) + node = self + while L: + nodeName = L.pop(0) + tmp_node = node.children.get(nodeName, None) + if tmp_node is None: + raise KeyError('No such node: %s' % key) + node = tmp_node + return node + + + def __setitem__(self, key, value): + """Sets the value contained by a node at key key""" + L = key.split(self.ComponentSep) + node = self + while L: + nodeName = L.pop(0) + tmp_node = node.children.get(nodeName, None) + if tmp_node is None: + tmp_node = Node() + tmp_node.name = nodeName + tmp_node.parent = node + node.children[nodeName] = tmp_node #<-- complete node init before querying default value! + tmp_node.value = self.getDefaultValue(tmp_node) + else: + node.children[nodeName] = tmp_node + node = tmp_node + node.value = value + + def get(self, key, default=None): + """Returns the node associated to key or default if the node does not exist""" + try: + return self[key] + except KeyError: + return default + + def getDefaultValue(self, node): + """Returns the default value of a node when a new node is about to be created + @paran node: the new node to query the default value for + @note: the default implementation returns None. Overwrite to customize + """ + return None + + def select(self, path): + """Selects node according to a path pattern + @patram path: (str) path pattern + @return: (list) of matching nodes + @note: the pattern supported is pretty simplistic. It may contain wildcards + to select any node 'key.*.other' or a double wildcard to recursively select all + childnodes 'key.**'. That's it. + """ + components = path.split(self.ComponentSep) + tmp_components = components[:] + stack = [[self, ], ] + while tmp_components: + tmp_stack = [] + component = tmp_components.pop(0) + for node in stack[-1]: + if component == '*': + for node in node.children.values(): + tmp_stack.append(node) + elif component == '**': + if tmp_components: + raise ValueError('Component "**" must be last component') + enum = node.walk() + enum.next() + for node in enum: + tmp_stack.append(node) + else: + node = node.children.get(component, None) + if node is not None: + tmp_stack.append(node) + if not tmp_stack: + break + stack.append(tmp_stack) + + if len(stack) == len(components) +1: + return stack[-1] + return [] + + def walk(self, report=False): + """Recursively iterates over the node and all its children + + @param report: if True, a tuple(levelup, node) is returned. Where levelup is set to 1 + if a node containing child nodes is about to be traversed, -1 if traversal of such a node + is completed and 0 if the node does not contain child nodes. If report is False, the next + node in turn is returned. + """ + if report: + def walker(node): + if node.children: + yield 1, node + else: + yield 0, node + for node in node.children.values(): + for x in walker(node): + yield x + if node.children: + yield -1, node + else: + def walker(node): + yield node + for node in node.children.values(): + for x in walker(node): + yield x + return walker(self) + +#*********************************************************************** +# +#*********************************************************************** +if __name__ == '__main__': + import doctest + print 'doctests failed: %s/%s' % doctest.testmod() + + + + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 08:08:02
|
Revision: 390 http://fclient.svn.sourceforge.net/fclient/?rev=390&view=rev Author: jUrner Date: 2008-04-09 01:08:07 -0700 (Wed, 09 Apr 2008) Log Message: ----------- docs Modified Paths: -------------- trunk/sandbox/fcp2/key.py Modified: trunk/sandbox/fcp2/key.py =================================================================== --- trunk/sandbox/fcp2/key.py 2008-04-09 08:04:37 UTC (rev 389) +++ trunk/sandbox/fcp2/key.py 2008-04-09 08:08:07 UTC (rev 390) @@ -72,6 +72,10 @@ """Metaclass for freenet keys""" def __new__(klass, name, bases, kws): + """Registers a key type to L{KeyTypesAll} + @note: if KeyType of the the key type is None it will not get registered + """ + newClass = type.__new__(klass, name, bases, kws) if newClass.KeyType is not None: KeyTypesAll[newClass.KeyType] = newClass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 08:04:38
|
Revision: 389 http://fclient.svn.sourceforge.net/fclient/?rev=389&view=rev Author: jUrner Date: 2008-04-09 01:04:37 -0700 (Wed, 09 Apr 2008) Log Message: ----------- metaclass fun for keys Modified Paths: -------------- trunk/sandbox/fcp2/key.py Modified: trunk/sandbox/fcp2/key.py =================================================================== --- trunk/sandbox/fcp2/key.py 2008-04-09 08:03:56 UTC (rev 388) +++ trunk/sandbox/fcp2/key.py 2008-04-09 08:04:37 UTC (rev 389) @@ -23,6 +23,7 @@ # consts #************************************************************************************** ReMatchExact = '\A%s\Z' +KeyTypesAll = {} #************************************************************************************** # freenet base64 for keys @@ -67,8 +68,21 @@ # see: [freenet/src/support/base64.java] # #*************************************************************************************** +class KeyMeta(type): + """Metaclass for freenet keys""" + + def __new__(klass, name, bases, kws): + newClass = type.__new__(klass, name, bases, kws) + if newClass.KeyType is not None: + KeyTypesAll[newClass.KeyType] = newClass + return newClass + +#************************************************************************************** +# +#************************************************************************************** class KeyBase(object): - """ + """Base class for freenet keys + >>> key = KeyBase.fcpToPython('CHK@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,AAAAAAA/foo') >>> key.pythonToFcp() 'CHK@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,AAAAAAA/foo/' @@ -99,12 +113,13 @@ """ - KeyTypesAll = {} + __metaclass__ = KeyMeta + KeyType = None @classmethod def fcpToPython(clss, string): key = stripKey(string) - for clssKeyType in clss.KeyTypesAll.values(): + for clssKeyType in KeyTypesAll.values(): result = clssKeyType.fromString(key) if result is not None: return result @@ -157,9 +172,6 @@ return clss -KeyBase.KeyTypesAll[CHK.KeyType] = CHK - - class SSK(KeyBase): _key_pattern_ = ''' (?P<keyType>SSK@) @@ -194,9 +206,7 @@ d = result.groupdict() return clss(d['keyData'], d['filename']) -KeyBase.KeyTypesAll[SSK.KeyType] = SSK - class KSK(KeyBase): _key_pattern_ = ''' (?P<keyType>KSK@) @@ -226,9 +236,6 @@ return clss -KeyBase.KeyTypesAll[KSK.KeyType] = KSK - - class USK(KeyBase): _key_pattern_ = ''' (?P<keyType>USK@) @@ -274,7 +281,6 @@ d = result.groupdict() return clss(d['keyData'], d['filename'], edition=d['edition']) -KeyBase.KeyTypesAll[USK.KeyType] = USK #***************************************************************************** # #***************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-04-09 08:03:55
|
Revision: 388 http://fclient.svn.sourceforge.net/fclient/?rev=388&view=rev Author: jUrner Date: 2008-04-09 01:03:56 -0700 (Wed, 09 Apr 2008) Log Message: ----------- docs Modified Paths: -------------- trunk/sandbox/fcp2/client.py Modified: trunk/sandbox/fcp2/client.py =================================================================== --- trunk/sandbox/fcp2/client.py 2008-04-09 07:45:33 UTC (rev 387) +++ trunk/sandbox/fcp2/client.py 2008-04-09 08:03:56 UTC (rev 388) @@ -881,7 +881,7 @@ #FIXME: does not work as expected # ClientPutdiskDir is just a subtype of ClientPutComplexDir - # and will be passed as Files.N.* container + # items will be passed as Files.N.* container elif requestType == consts.RequestType.PutMultiple: initialRequest = message.ClientPutComplexDir() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |