Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket3252 port web directory.remaining.1 #672

Merged

Conversation

meejah
Copy link
Contributor

@meejah meejah commented Dec 22, 2019

fixes:ticket:3252

Port the "directory" functionality from nevow to twisted.web.template

There are a lot of lines of changes here, but there are a bunch of "mechanical" changes that required some re-indenting and search-replace changes -- these are "tags" (HTML built up in code) stuff, changing from "context" to "request" objects and a bunch of stuff switching regular-expression use in tests to BeautifulSoup


This change is Reviewable

@meejah
Copy link
Contributor Author

meejah commented Dec 23, 2019

Arg, the perils of comparing strings ... (to repeat the circle-ci failures, use the same PYTHONHASHSEED)

@codecov-io
Copy link

codecov-io commented Dec 28, 2019

Codecov Report

Merging #672 into master will increase coverage by 0.57%.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
+ Coverage   89.66%   90.24%   +0.57%     
==========================================
  Files         164      164              
  Lines       29015    29004      -11     
  Branches     4131     4131              
==========================================
+ Hits        26017    26174     +157     
+ Misses       2234     2095     -139     
+ Partials      764      735      -29
Impacted Files Coverage Δ
src/allmydata/web/filenode.py 94.09% <100%> (-0.15%) ⬇️
src/allmydata/web/common.py 89.48% <100%> (-1.18%) ⬇️
src/allmydata/scripts/tahoe_backup.py 88.51% <100%> (+8.27%) ⬆️
src/allmydata/web/root.py 87.78% <50%> (-1.18%) ⬇️
src/allmydata/web/directory.py 92.25% <98.35%> (-0.31%) ⬇️
src/allmydata/web/status.py 84.61% <0%> (+0.22%) ⬆️
src/allmydata/mutable/servermap.py 94.22% <0%> (+0.48%) ⬆️
src/allmydata/scripts/runner.py 75.53% <0%> (+0.71%) ⬆️
src/allmydata/frontends/magic_folder.py 88.19% <0%> (+0.81%) ⬆️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d3474a...fdd8f52. Read the comment docs.

@meejah meejah marked this pull request as ready for review December 28, 2019 08:09
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Various comments inline, as usual.

src/allmydata/test/test_dirnode.py Outdated Show resolved Hide resolved
src/allmydata/test/cli/test_cli.py Show resolved Hide resolved
src/allmydata/test/web/common.py Outdated Show resolved Hide resolved
src/allmydata/test/web/test_grid.py Show resolved Hide resolved
src/allmydata/test/web/test_grid.py Show resolved Hide resolved
src/allmydata/web/directory.py Outdated Show resolved Hide resolved
src/allmydata/test/web/test_web.py Show resolved Hide resolved
src/allmydata/test/web/test_web.py Outdated Show resolved Hide resolved
src/allmydata/test/web/test_web.py Outdated Show resolved Hide resolved
src/allmydata/test/web/test_web.py Outdated Show resolved Hide resolved
@meejah
Copy link
Contributor Author

meejah commented Feb 1, 2020

Okay, minus the Hypothesis thing I've made changes for all your comments. Thanks!

@meejah meejah requested a review from exarkun February 11, 2020 19:12
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think the changes generally look good. There are some comments looks like they may have been missed. I'm confused at how github is presenting them. I don't see them on this page at all... Oh they're hidden behind a "14 hidden conversations" button for some reason....

Did you see those?

src/allmydata/test/cli/test_cli.py Show resolved Hide resolved
@meejah
Copy link
Contributor Author

meejah commented Mar 2, 2020

Okay, so this whole "should /foo/bar/ actually be the very same thing as /foo/bar opens up a can of worms (see the suggestion/review comment by @exarkun about the return self in getChild and that maybe it should be a re-direct). There are at least a bunch of tests that treat "/uri/foo/" as if it should be the same thing as "/uri/foo" -- but also they have some query args. twisted.web.util.redirectTo doesn't do query args .. and so before I went and wrote a thing that "does a redirect, but also respects query args" I thought "maybe we SHOULD just delete that?".

So the question is: should /uri/foo/bar/ just be an error / empty? Or should it re-direct to /uri/foo/bar?

edit: the plot thickens, tahoe backup seems to "always" but a trailing-slash on URIs...

@meejah
Copy link
Contributor Author

meejah commented Apr 10, 2020

I tried to make an alternative to the last commit that does a 307 redirect (instead of making it an error) on urls like /foo/bar/ ... buuut I think twisted's web client has a bug (that it doesn't do POST redirects ever) and also at least one thing in Tahoe is using httplib (!!!) as a client which also won't re-direct.

So, I could still make it a re-direct instead of an error fairly easily, but a lot of the other changes to tahoe backup and the tests (in that last commit) would have to stay. @exarkun opinions?

Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This was a slog to read. I'm sure it was worse to write. ;) Overall my impression is that we have a ton of work left to do to clean up Tahoe-LAFS' web interface... However this appears to be a significant and valid step towards eliminating the Nevow dependency ...

So, please have a look at the very minor inline comments and then .. I want to say "feel free to merge" but I guess we have to do something about CI.

None of the configured GitHub Actions have run for this PR. Is it older than them? I don't think so. I read something about how both repos (original and fork) have to have GitHub Actions turned on for them to run ... but the thread was fairly unclear so I'm not sure that's it. The simplest thing might just be to prefer in-repo PRs instead of PRs from forks... I dunno. After reading all that web code I can't also think about minimizing GitHub workflow weirdness.

src/allmydata/test/test_dirnode.py Show resolved Hide resolved
src/allmydata/test/web/test_web.py Outdated Show resolved Hide resolved
src/allmydata/web/common.py Outdated Show resolved Hide resolved
src/allmydata/web/root.py Outdated Show resolved Hide resolved
@meejah meejah force-pushed the ticket3252-port-web-directory.remaining.1 branch from fdd8f52 to 8df1ed1 Compare April 23, 2020 18:15
@meejah meejah merged commit 4dc3702 into tahoe-lafs:master Apr 23, 2020
@meejah meejah deleted the ticket3252-port-web-directory.remaining.1 branch April 23, 2020 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants