Merge lp://qastaging/~diegosarmentero/ubuntuone-client/search-filter into lp://qastaging/ubuntuone-client
Proposed by
Diego Sarmentero
Status: | Merged |
---|---|
Approved by: | Diego Sarmentero |
Approved revision: | 1352 |
Merged at revision: | 1350 |
Proposed branch: | lp://qastaging/~diegosarmentero/ubuntuone-client/search-filter |
Merge into: | lp://qastaging/ubuntuone-client |
Diff against target: |
507 lines (+324/-1) 14 files modified
contrib/testing/testcase.py (+2/-0) tests/platform/ipc/test_external_interface.py (+9/-0) tests/platform/test_tools.py (+20/-0) tests/syncdaemon/test_files_search.py (+87/-0) tests/syncdaemon/test_fsm.py (+107/-0) ubuntuone/platform/ipc/ipc_client.py (+4/-0) ubuntuone/platform/ipc/linux.py (+6/-0) ubuntuone/platform/ipc/perspective_broker.py (+5/-0) ubuntuone/platform/tools/__init__.py (+5/-0) ubuntuone/syncdaemon/files_search.py (+48/-0) ubuntuone/syncdaemon/filesystem_manager.py (+17/-1) ubuntuone/syncdaemon/interaction_interfaces.py (+6/-0) ubuntuone/syncdaemon/main.py (+3/-0) ubuntuone/syncdaemon/volume_manager.py (+5/-0) |
To merge this branch: | bzr merge lp://qastaging/~diegosarmentero/ubuntuone-client/search-filter |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike McCracken (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+130862@code.qastaging.launchpad.net |
Description of the change
This will be used from control panel, instead of having the data of the files inside u1 duplicated there, and this will be fix the problems to keep that data up to date, and check if the files are already in the server (as the two bug reports describe).
To post a comment you must log in.
I don't really agree with replacing spaces with '.+'.
The old share_links_search does a substring search in just the
basename, while this matches the whole path, which I think is a good
idea.
However, I was expecting this to also be substring search, but you are
replacing spaces in the search string with '.+', which means the
behavior is a little unexpected wrt. spaces in the search text.
Here's a test to be added to test_fsm.py in FSMSearchTestCase that shows what I mean:
def test_get_ paths_by_ pattern_ with_spaces( self): to/a/file/ deep/in/ the/woods/ called/ a file' to/anythingyouw ant-to- defile'
self.fsm. _idx_path = {path: mdid, path2: mdid2} re.escape( 'a file').split('\\ ')) get_paths_ by_pattern( search) by_pattern: ", result
self.assertEqu al(result, expected)
"""Test that spaces in a pattern are handled as expected."""
mdid = 'id'
path = '/my/path/
mdobj = {'server_hash': 'asdqwe123'}
mdid2 = 'id2'
path2 = '/my/path/
mdobj2 = {'server_hash': 'asdqwe456'}
self.fsm.fs = {mdid: mdobj, mdid2: mdobj2}
expected = [path]
# expectations
paths = "(%s|%s)" % ('/my/path/', '/home/')
pattern = paths + ".*/.*%s.*$"
keywords = '.+'.join(
print "keywords:", keywords
search = pattern % keywords
result = self.fsm.
print "result from get_paths_
I would expect "a file" to not match "anythingyouwan t-to-defile" . It
matches both:
Here's what that test prints: to/a/file/ deep/in/ the/woods/ called/ a file id to/a/file/ deep/in/ the/woods/ called/ a file to/anythingyouw ant-to- defile id2 to/anythingyouw ant-to- defile by_pattern: ['/my/path/ to/a/file/ deep/in/ the/woods/ called/ a file', '/my/path/ to/anythingyouw ant-to- defile' ] mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ parts/ubuntuone -client/ tests/syncdaemo n/test_ fsm.py" , line 4361, in test_get_ paths_by_ pattern_ with_spaces assertEqual( result, expected) mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ eggs/Twisted- 11.1.0- py2.7-macosx- 10.7-x86_ 64.egg/ twisted/ trial/unittest. py", line 270, in assertEqual trial.unittest. FailTest: not equal: to/a/file/ deep/in/ the/woods/ called/ a file', to/anythingyouw ant-to- defile' ] to/a/file/ deep/in/ the/woods/ called/ a file']
keywords: a.+file
searching through /my/path/
match with p= /my/path/
searching through /my/path/
match with p= /my/path/
result from get_paths_
Traceback (most recent call last):
File "/Users/
self.
File "/Users/
% (msg, pformat(first), pformat(second)))
twisted.
a = ['/my/path/
'/my/path/
b = ['/my/path/