PASTAplus / web-x

The EDI Website Project
Apache License 2.0
1 stars 1 forks source link

request that news item from 2017 be added asap #23

Closed mobb closed 2 years ago

mobb commented 2 years ago

For the Core Trust Seal application, we have a news item referenced (dataone node announcement). Can we have this news entry added soonish? so that there are no broken links in the application, which I would like to send in this week.

Here is the wordpress entry: https://environmentaldatainitiative.org/2017/04/18/edi-is-40th-dataone-member-node/

Following the format of the other news items, I assume it will be: https://edirepository.org/news/news-20170418.00

clnsmth commented 2 years ago

@mobb I'll get this added shortly and post the link here.

clnsmth commented 2 years ago

@servilla I've added this page to content-x, run build.py, and it shows up on http://127.0.0.1:8000/news/news-grid but throws an Internal Server Error when resolving to http://127.0.0.1:8000/news/news-20170418.00. The page has been added to the remote main branch of both content-x and web-x. I can't figure this one out and need a little help (thanks).

The call stack:

INFO:     127.0.0.1:50646 - "GET /news/news-20170418.00 HTTP/1.1" 500 Internal Server Error
2022-04-19 13:04:29,207 [17172] ERROR    uvicorn.error: Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 366, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\uvicorn\middleware\debug.py", line 96, in __call__
    raise exc from None
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\uvicorn\middleware\debug.py", line 93, in __call__
    await self.app(scope, receive, inner_send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi\applications.py", line 261, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\middleware\errors.py", line 181, in __call__
    raise exc
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\middleware\errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\exceptions.py", line 82, in __call__
    raise exc
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\routing.py", line 61, in app
    response = await func(request)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi\routing.py", line 227, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi\routing.py", line 162, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\anyio\to_thread.py", line 28, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\anyio\_backends\_asyncio.py", line 818, in run_sync_in_worker_thread
    return await future
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\anyio\_backends\_asyncio.py", line 754, in run
    result = context.run(func, *args)
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\site-packages\fastapi_chameleon\engine.py", line 88, in sync_view_method
    response_val = f(*args, **kwargs)
  File "C:\Users\Colin\Documents\EDI\projects\web-x\views\news.py", line 35, in news
    vm = NewsViewModel(request, f"News - {name} ", name=name)
  File "C:\Users\Colin\Documents\EDI\projects\web-x\viewmodels\news\news_viewmodel.py", line 27, in __init__
    self.main = get_post_html("news", name)
  File "C:\Users\Colin\Documents\EDI\projects\web-x\services\post_service.py", line 87, in get_post_html
    with Path(post_file).open("r", encoding="utf-8") as f:
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "C:\Users\Colin\anaconda3\envs\web-x\lib\pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'templates\\news\\news-20170418.00.html'
servilla commented 2 years ago

This No such file or directory: 'templates\\news\\news-20170418.00.html' error should have provided a good clue ;-).

The file name in content-x news-20170418.00 .md had an extra space between the last ".00" and the ".md", which carried over into web-x. The file processor in web-x that is used to sort the files into date descending order, however, uses only the stripped file name root ("news-20170418.00") for sorting purposes and then creates the links by appending the ".html" on the end - it didn't add that extra space into the full file name, so the get_post_html function resulted in a file not found exception.

I renamed that file without the extra space in content-x, which then processed cleanly.

clnsmth commented 2 years ago

Thanks @servilla. I'll make an appointment with my ophthalmologist.