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

Use PurePosixPath for URL paths #3

Merged
merged 1 commit into from
Jan 29, 2019
Merged

Use PurePosixPath for URL paths #3

merged 1 commit into from
Jan 29, 2019

Conversation

hroncok
Copy link
Member

@hroncok hroncok commented Jan 29, 2019

(Maybe) Fixes #2

untested

@encukou encukou merged commit 01dedad into master Jan 29, 2019
@hroncok hroncok deleted the pureposixpath branch January 29, 2019 16:22
@encukou
Copy link
Member

encukou commented Jan 29, 2019

Thank you!
I don't have a good way to test on Windows, but this works for me on Linux.

@hroncok
Copy link
Member Author

hroncok commented Jan 29, 2019

Me neither.

@hroncok
Copy link
Member Author

hroncok commented Jan 29, 2019

If you know a command I can recommend to @Zuzanita without screwing her Pipfile, I'd appreciate it.

@hroncok
Copy link
Member Author

hroncok commented Jan 29, 2019

(command to update naucse_render)

@encukou
Copy link
Member

encukou commented Jan 29, 2019

This might work:

pipenv run pip install -U git+https://github.com/pyvec/naucse_render.git#egg=naucse_render

@hroncok
Copy link
Member Author

hroncok commented Jan 29, 2019

Got Windows!

...
Rendering page intro/micropython (index)
ERROR:flask.app:Exception on /static/css/body.css [GET]
Traceback (most recent call last):
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\app.py", line 1811, in full_dispatch_request
    rv = self.preprocess_request()
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask\app.py", line 2087, in preprocess_request
    rv = func()
  File "C:\Users\Linux\naucse.python.cz\naucse\views.py", line 51, in _get_model

    g.model.freeze()
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 1029, in freeze
    course.freeze()
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 816, in freeze
    self.load_all_lessons()
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 799, in load_all
_lessons
    self.load_lessons(self._requested_lessons)
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 780, in load_les
sons
    parent=self,
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 603, in load

    return converter.load(data[slug], **kwargs)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 215, in load

    result[k] = self.item_converter.load(v, **kwargs)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 468, in load

    field.load_into(result, data, parent=result)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 360, in load
_into
    value = self.converter.load(item_data, **kwargs)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 215, in load

    result[k] = self.item_converter.load(v, **kwargs)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 468, in load

    field.load_into(result, data, parent=result)
  File "C:\Users\Linux\naucse.python.cz\naucse\converters.py", line 360, in load
_into
    value = self.converter.load(item_data, **kwargs)
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 162, in load
    return self.sanitizer(parent, value)
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 147, in _sanitiz
e_page_content
    'static': static_url,
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 198, in saniti
ze_html
    for fragment in lxml.html.fragments_fromstring(text)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 198, in <listc
omp>
    for fragment in lxml.html.fragments_fromstring(text)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 186, in saniti
ze_fragment
    sanitize_element(fragment, naucse_urls=naucse_urls)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 179, in saniti
ze_element
    sanitize_element(child, naucse_urls=naucse_urls)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 179, in saniti
ze_element
    sanitize_element(child, naucse_urls=naucse_urls)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 169, in saniti
ze_element
    attr_name, value, naucse_urls=naucse_urls)
  File "C:\Users\Linux\naucse.python.cz\naucse\sanitize.py", line 103, in conver
t_link
    new_url = naucse_urls[url.path](**query)
  File "C:\Users\Linux\naucse.python.cz\naucse\models.py", line 140, in static_u
rl
    return parent_page.lesson.static_files[filename].get_url(**kw)
KeyError: 'pics/grass.svg'
Traceback (most recent call last):
  File "C:\Users\Linux\AppData\Local\Programs\Python\Python36-32\Lib\runpy.py",
line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Linux\AppData\Local\Programs\Python\Python36-32\Lib\runpy.py",
line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Linux\naucse.python.cz\naucse\__main__.py", line 3, in <module>

    main()
  File "C:\Users\Linux\naucse.python.cz\naucse\cli.py", line 8, in main
    elsa.cli(app, base_url='https://naucse.python.cz')
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
elsa\_cli.py", line 158, in cli
    return command()
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
elsa\_cli.py", line 113, in freeze
    freeze_app(app, freezer, path, base_url, verbose=verbose)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
elsa\_cli.py", line 50, in freeze_app
    for page in freezer.freeze_yield():
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask_frozen\__init__.py", line 183, in freeze_yield
    new_filename = self._build_one(url)
  File "C:\Users\Linux\.virtualenvs\naucse.python.cz-Ap5RjXMi\lib\site-packages\
flask_frozen\__init__.py", line 322, in _build_one
    % (response.status, url))
ValueError: Unexpected status '500 INTERNAL SERVER ERROR' on URL /static/css/bod
y.css

C:\Users\Linux\naucse.python.cz>

@hroncok
Copy link
Member Author

hroncok commented Jan 29, 2019

Reported as pyvec/naucse.python.cz#517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants