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

Updates and Bug Fixes #261

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ A website template co-developed with NMHSs in Africa to support their digital tr
practices in web design and development, data visualization and hydro meteorological and climate communications to
ensure that NMHSs have a modern, responsive, and user-friendly website.

## Live Instances
NMHSs that have adopted ClimWeb across Africa:
- 🇧🇯 [Benin](https://www.meteobenin.bj/)
- 🇧🇫 [Burkina Faso](https://www.meteoburkina.bf/)
- 🇧🇮 [Burundi](https://www.igebu.bi/)
- 🇹🇩 [Chad](https://www.meteotchad.org/)
- 🇪🇹 [Ethiopia](https://www.ethiomet.gov.et/)
- 🇬🇭 [Ghana](https://www.meteo.gov.gh/)
- 🇲🇼 [Malawi](https://www.metmalawi.gov.mw/)
- 🇲🇱 [Mali](https://www.malimeteo.ml/)
- 🇳🇪 [Niger](https://www.niger-meteo.ne/)
- 🇸🇨 [Seychelles](https://www.meteo.sc/)
- 🇸🇸 [South Sudan](https://meteosouthsudan.com.ss/)
- 🇸🇩 [Sudan](https://meteosudan.sd/)
- 🇹🇬 [Togo](https://www.anamet-togo.com/)
- 🇿🇼 [Zimbabwe](https://www.weatherzw.org.zw/)
- And many more to go live soon.


## 🌟 Core Features

- 🙂 User friendly website Content Management System
Expand Down
14 changes: 14 additions & 0 deletions climweb/src/climweb/base/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class InstanceTypeAlreadyRegistered(Exception):
"""
Raised when the instance model instance is already registered in the registry.
"""


class InstanceTypeDoesNotExist(Exception):
"""
Raised when a requested instance model instance isn't registered in the registry.
"""

def __init__(self, type_name, *args, **kwargs):
self.type_name = type_name
super().__init__(*args, **kwargs)
9 changes: 9 additions & 0 deletions climweb/src/climweb/base/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.core.exceptions import ImproperlyConfigured

from .exceptions import InstanceTypeDoesNotExist, InstanceTypeAlreadyRegistered


class Instance(object):
"""
Expand Down Expand Up @@ -27,6 +29,13 @@ def before_unregister(self):

class Registry(Instance):
name = None
"""The unique name that is used when raising exceptions."""

does_not_exist_exception_class = InstanceTypeDoesNotExist
"""The exception that is raised when an instance doesn't exist."""

already_registered_exception_class = InstanceTypeAlreadyRegistered
"""The exception that is raised when an instance is already registered."""

def __init__(self):
if not getattr(self, "name", None):
Expand Down