summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pgweb/misc/__init__.py0
-rw-r--r--pgweb/misc/forms.py30
-rw-r--r--pgweb/misc/models.py3
-rw-r--r--pgweb/misc/views.py49
-rw-r--r--pgweb/settings.py1
-rw-r--r--pgweb/urls.py1
-rw-r--r--templates/misc/bug_completed.html12
-rw-r--r--templates/misc/bug_header.html37
-rw-r--r--templates/misc/bugmail.txt11
9 files changed, 144 insertions, 0 deletions
diff --git a/pgweb/misc/__init__.py b/pgweb/misc/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/pgweb/misc/__init__.py
diff --git a/pgweb/misc/forms.py b/pgweb/misc/forms.py
new file mode 100644
index 00000000..9d8ea0d3
--- /dev/null
+++ b/pgweb/misc/forms.py
@@ -0,0 +1,30 @@
+from django import forms
+
+from pgweb.core.models import Version
+
+class _version_choices():
+ def __iter__(self):
+ yield ('-1', '** Select version')
+ for v in Version.objects.all():
+ for minor in range(v.latestminor,-1,-1):
+ s = "%s.%s" % (v.tree, minor)
+ yield (s,s)
+ yield ('Unsupported/Unknown', 'Unsupported/Unknown')
+
+class SubmitBugForm(forms.Form):
+ name = forms.CharField(max_length=100, required=True)
+ email = forms.EmailField(max_length=100, required=True)
+ pgversion = forms.CharField(max_length=20, required=True,
+ label="PostgreSQL version",
+ widget=forms.Select(choices=_version_choices()))
+ os = forms.CharField(max_length=50, required=True,
+ label="Operating system")
+ shortdesc = forms.CharField(max_length=100, required=True,
+ label="Short description")
+ details = forms.CharField(required=True, widget=forms.Textarea)
+
+ def clean_pgversion(self):
+ if self.cleaned_data.get('pgversion') == '-1':
+ raise forms.ValidationError('You must select a version')
+ return self.cleaned_data.get('pgversion')
+
diff --git a/pgweb/misc/models.py b/pgweb/misc/models.py
new file mode 100644
index 00000000..71a83623
--- /dev/null
+++ b/pgweb/misc/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/pgweb/misc/views.py b/pgweb/misc/views.py
new file mode 100644
index 00000000..3f5c3ba5
--- /dev/null
+++ b/pgweb/misc/views.py
@@ -0,0 +1,49 @@
+from django.shortcuts import render_to_response, get_object_or_404
+from django.http import HttpResponseRedirect, HttpResponse, Http404
+from django.db import connection
+from email.mime.text import MIMEText
+from django.conf import settings
+
+from pgweb.util.contexts import NavContext
+from pgweb.util.helpers import template_to_string
+from pgweb.util.misc import sendmail
+
+from pgweb.core.models import Version
+
+from forms import *
+
+def submitbug(request):
+ if request.method == 'POST':
+ form = SubmitBugForm(request.POST)
+ if form.is_valid():
+ c = connection.cursor()
+ c.execute("SELECT nextval('bug_id_seq')")
+ bugid = c.fetchall()[0][0]
+
+ msg = MIMEText(
+ template_to_string('misc/bugmail.txt', {
+ 'bugid': bugid,
+ 'bug': form.cleaned_data,
+ }),
+ _charset='utf-8')
+ msg['Subject'] = 'BUG #%s: %s' % (bugid, form.cleaned_data['shortdesc'])
+ msg['To'] = settings.BUGREPORT_EMAIL
+ msg['From'] = form.cleaned_data['email']
+ sendmail(msg)
+
+ return render_to_response('misc/bug_completed.html', {
+ 'bugid': bugid,
+ }, NavContext(request, 'support'))
+ else:
+ form = SubmitBugForm()
+
+ versions = Version.objects.all()
+
+ return render_to_response('base/form.html', {
+ 'form': form,
+ 'formitemtype': 'Bug report',
+ 'form_intro': template_to_string('misc/bug_header.html', {
+ 'supportedversions': versions,
+ }),
+ }, NavContext(request, 'support'))
+
diff --git a/pgweb/settings.py b/pgweb/settings.py
index 9d003d61..87f19699 100644
--- a/pgweb/settings.py
+++ b/pgweb/settings.py
@@ -103,6 +103,7 @@ INSTALLED_APPS = [
'pgweb.lists',
'pgweb.sponsors',
'pgweb.survey',
+ 'pgweb.misc',
]
diff --git a/pgweb/urls.py b/pgweb/urls.py
index e04509fe..4606654c 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -47,6 +47,7 @@ urlpatterns = patterns('',
(r'^support/professional_(support|hosting)/$', 'profserv.views.root'),
(r'^support/professional_(support|hosting)[/_](.*)/$', 'profserv.views.region'),
+ (r'^support/submitbug/$', 'misc.views.submitbug'),
(r'about/sponsors/$', 'pgweb.sponsors.views.sponsors'),
(r'about/servers/$', 'pgweb.sponsors.views.servers'),
diff --git a/templates/misc/bug_completed.html b/templates/misc/bug_completed.html
new file mode 100644
index 00000000..0236cf0c
--- /dev/null
+++ b/templates/misc/bug_completed.html
@@ -0,0 +1,12 @@
+{%extends "base/page.html"%}
+{%block title%}Bug report{%endblock%}
+{%block contents%}
+<h1>Bug report</h1>
+<p>
+Your bug report has been received, and given id #{{bugid}}. It has been posted
+to the <a href="http://archives.postgresql.org/pgsql-bugs/">pgsql-bugs</a>
+mailinglist and will show up there as soon as it has cleared the moderator
+queue.
+</p>
+{%endblock%}
+
diff --git a/templates/misc/bug_header.html b/templates/misc/bug_header.html
new file mode 100644
index 00000000..12ec4e3e
--- /dev/null
+++ b/templates/misc/bug_header.html
@@ -0,0 +1,37 @@
+<p>Please ensure you have read the
+<a href="/docs/current/static/bug-reporting.html">bug reporting guidelines</a>
+before reporting a bug. In particular, please re-read the
+<a href="/docs/current/static/">documentation</a> to verify that what you are
+trying is possible. If the documentation is not clear, please report that, too;
+it is a documentation bug. If a program does something different from what the
+documentation says, that is also a bug.</p>
+
+<p>Poor performance is not necessarily a bug. Read the documentation or ask on
+one of the <a href="/community/lists/">mailing lists</a> for help in tuning
+your applications. Failing to comply to the SQL standard is not necessarily a
+bug either, unless compliance for the specific feature is explicitly claimed.</p>
+
+<p>Before you continue, check on the
+<a href="http://wiki.postgresql.org/wiki/Todo">TODO list</a> and in the
+<a href="/docs/faq/">FAQ</a> to see if your bug is already known. If you cannot
+decode the information on the TODO list, report your problem so we can clarify
+the TODO list.</p>
+
+<p>To report a security bug, please send an email to
+<a href="mailto:security@postgresql.org">security@postgresql.org</a>. All
+other bugs will be forwarded to the
+<a href="http://archives.postgresql.org/pgsql-bugs/">pgsql-bugs</a> mailing
+list where they will be publicly archived.</p>
+
+<p>Make sure you are running the latest available minor release for your major
+<a href="/support/versioning">version</a> before reporting a bug. The current
+list of supported versions is
+{%for ver in supportedversions%}{{ver}}{%if not forloop.last%}, {%endif%}{%endfor%}.
+</p>
+
+<p>This bug report form should only be used for reporting bugs and problems
+with the PostgreSQL database. Problems with database connectors such as ODBC
+and JDBC, graphical administration tools such as pgAdmin or other external
+projects <b>should not be reported here</b>; please report to those projects
+directly. For products closely connected with PostgreSQL, there may be an
+appropriate <a href='/community/lists'>mailing list</a> available.</p>
diff --git a/templates/misc/bugmail.txt b/templates/misc/bugmail.txt
new file mode 100644
index 00000000..1ee95811
--- /dev/null
+++ b/templates/misc/bugmail.txt
@@ -0,0 +1,11 @@
+The following bug has been logged on the website:
+
+Bug reference: {{bugid}}
+Logged by: {{bug.name|wordwrap:76}}
+Email address: {{bug.email|wordwrap:76}}
+PostgreSQL version: {{bug.pgversion|wordwrap:76}}
+Operating system: {{bug.os|wordwrap:76}}
+Description: {{bug.shordesc|wordwrap:76}}
+
+{{bug.details|wordwrap:76}}
+