Code Monkey home page Code Monkey logo

Comments (8)

davidfokkema avatar davidfokkema commented on June 9, 2024

What links point back to the 404? This should indeed not happen. Moreover, the missing Summary object should be handled more gracefully.

from publicdb.

153957 avatar 153957 commented on June 9, 2024

In commits 0ff6d36 and 9ecc379 I have tried to improve on this, to make sure we don't provide links to pages that will fail because of missing Summary objects (or rather; because of existing Summary objects related to days without any data).

Mainly by adding this to filters; Q(num_events__isnull=False) | Q(num_weather__isnull=False)
And additionally to some I added; date__gte=datetime.date(2002, 1, 1), date__lte=datetime.date.today()
To prevent linking to future dates and to before we started this.

In case it does happen, it would be nice If we have a better 404 page redirecting people back to the homepage.

from publicdb.

davidfokkema avatar davidfokkema commented on June 9, 2024

In the view, something like this?

try:
    Summary.objects.get(date)
except Summary.DoesNotExist:
    return render_to_response('there_is_no_data_on_this_day.html')
else:
    foo()
    return render_to_response('data_pagina.html')

from publicdb.

153957 avatar 153957 commented on June 9, 2024

Hmm, that might indeed be a good addition, even if we dont link to dates without data, people might edit links themselves.
A similar check could be done for the station id. And then we could also add one for the status page of in active stations.. etc..
But this might get to convoluted, it would be nice, but would a general (but specific to our site) 404 page not be sufficient?

from publicdb.

davidfokkema avatar davidfokkema commented on June 9, 2024

I was a bit short in my code. The Summary is linked to the station and a specific date. And you have to check for events; there might only be error messages on a particular day. The error page can be more general, but I'd like to have some separation between:

data.hisparc.nl/foo/bar/baz/ -> 404 (url not found)
data.hisparc.nl/show/station/501/2012/04/18 -> 404 (no data)

from publicdb.

153957 avatar 153957 commented on June 9, 2024

Should we then also have;
data.hisparc.nl/django/show/station/555/[date] -> 404 (no station)
data.hisparc.nl/django/show/station/10001/status -> 404 (not active)
data.hisparc.nl/django/show/station/10001/config -> 404 (no config)

I do agree that there should be a difference between a 404 from a bad url pattern and from missing data and such.

from publicdb.

153957 avatar 153957 commented on June 9, 2024

General 403, 404 and 500 pages made in commit aea6b73

from publicdb.

153957 avatar 153957 commented on June 9, 2024

Almost all broken links are gone.
500 errors get reported and fixed quick enough.
404 errors might need to be monitored a bit more to fix remaining broken links.
But good enough for now, closing.

from publicdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.