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

add timezone in building progress #94

Closed
Seele0oO opened this issue Feb 10, 2023 · 14 comments
Closed

add timezone in building progress #94

Seele0oO opened this issue Feb 10, 2023 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@Seele0oO
Copy link
Contributor

The default TZ is utc+0.
I think it would be more helpful to the visitors of the site if this feature is added.

@knadh knadh added the enhancement New feature or request label Feb 27, 2023
@knadh knadh self-assigned this Feb 27, 2023
@knadh knadh closed this as completed in a9d2f2f Feb 27, 2023
@Seele0oO
Copy link
Contributor Author

2023-02-27 10:20:21,264: building site
Traceback (most recent call last):
  File "/usr/local/bin/tg-archive", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/__init__.py", line 161, in main
    b.build()
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 87, in build
    self._render_page(messages, month, dayline,
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 116, in _render_page
    html = self.template.render(config=self.config,
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 90, in top-level template code
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 485, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'collections.OrderedDict object' has no attribute '2019-10-25'

there is some error.

@Seele0oO
Copy link
Contributor Author

same error in another tg-archive project

2023-02-27 10:24:18,143: building site
Traceback (most recent call last):
  File "/usr/local/bin/tg-archive", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/__init__.py", line 161, in main
    b.build()
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 87, in build
    self._render_page(messages, month, dayline,
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 116, in _render_page
    html = self.template.render(config=self.config,
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 90, in top-level template code
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 485, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'collections.OrderedDict object' has no attribute '2020-06-01'

@knadh
Copy link
Owner

knadh commented Feb 27, 2023

hmm, investigating this.

@Seele0oO
Copy link
Contributor Author

Thank you for your attention.

@knadh
Copy link
Owner

knadh commented Feb 27, 2023

Unable to reproduce this.

  • Did you add timezone config?
  • Are you using a customized template.html?

@Seele0oO
Copy link
Contributor Author

  1. image
  2. no,I'm using the default.

@knadh
Copy link
Owner

knadh commented Feb 27, 2023

Tried Asia/Shanghai and it works fine on a site with messages that span multiple years. Maybe there is one particular entry in your DB that's somehow being counted as UTC (in the get_timeline() method perhaps) and with a timezone when generating the message. I missed adding timezone support to get_timeline() and get_dayline(). Will add a push a fix.

@knadh
Copy link
Owner

knadh commented Feb 27, 2023

Can you try v1.1.1?

@Seele0oO
Copy link
Contributor Author

2023-02-27 12:19:00,746: building site
Traceback (most recent call last):
  File "/usr/local/bin/tg-archive", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/__init__.py", line 161, in main
    b.build()
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 87, in build
    self._render_page(messages, month, dayline,
  File "/usr/local/lib/python3.10/dist-packages/tgarchive/build.py", line 116, in _render_page
    html = self.template.render(config=self.config,
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 90, in top-level template code
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 485, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'collections.OrderedDict object' has no attribute '2019-10-25'
tg-archive -v
v1.1.1

it's a bad news.

@Seele0oO
Copy link
Contributor Author

Seele0oO commented Oct 2, 2023

@knadh
I noticed this again as I have in trying to update all the packages, currently removing the softlinks in the build parameter, I think it may work, due to the number of media files in the message it may take a few hours to know the exact result.
If it still fails, I will try to do some testing in github action.

@Seele0oO
Copy link
Contributor Author

Seele0oO commented Oct 3, 2023

It doesn't seem feasible, but I made a github action to do automatic testing.

@scarlion1
Copy link
Contributor

Hi @Seele0oO have you figured anything yet? It is caused by using --symlinks option? Anything I can to do help fix?

@Seele0oO
Copy link
Contributor Author

Seele0oO commented Nov 3, 2023

@scarlion1 I apologize for the long delay in responding. It may not have been a problem with my judgment, now I have to go back to version 1.0.0.

@scarlion1
Copy link
Contributor

@Seele0oO No worries, we are still working on it over on #99

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

No branches or pull requests

3 participants