Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 7 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
3  docs/changes/release_notes.rst
@@ -91,6 +91,9 @@ New Features in 1.2
US census TIGER data; without it, we were getting geocoding failures,
confusing/ambigous street names in the UI, etc. Closes #264.
+* ``NewsItem`` now allows saving with an empty ``description.``;
+ some things might really only have a title available.
+
* Support multiple types of Yahoo maps, due to olwidget upgrade.
* ebpub.geocoder.base.full_geocode() now has a convert_to_block
View
3  ebdata/ebdata/scrapers/general/spreadsheet/retrieval.py
@@ -320,6 +320,9 @@ def save(self, old_record, list_record, detail_record):
return self.create_or_update(old_record, attributes,
**form.cleaned_data)
else:
+ self.logger.info("Skipping due to validation failures:")
+ for key, val in form.errors.items():
+ self.logger.info("%s: %s" % (key, val.as_text()))
raise SkipRecord(form.errors)
View
4 ebpub/ebpub/db/models.py
@@ -1271,9 +1271,9 @@ class NewsItem(models.Model):
schema = models.ForeignKey(Schema, help_text=u'What kind of news is this and what extra fields does it have?')
title = models.CharField(max_length=255, help_text=u'the "headline"')
- description = models.TextField()
+ description = models.TextField(blank=True, default=u'')
url = models.TextField(
- blank=True,
+ blank=True, default=u'',
help_text="link to original source for this news")
pub_date = models.DateTimeField(
db_index=True,
View
3  ebpub/ebpub/db/schemafilters.py
@@ -1011,7 +1011,8 @@ def add(self, key, *values, **kwargs):
if not isinstance(val, NewsitemFilter):
logger.warn("SchemaFilter.add called with key %r and unexpected values %r, not adding."
% (key, values))
- logger.warn('path was: %s' % self.request.get_full_path())
+ if self.request:
+ logger.warn('path was: %s' % self.request.get_full_path())
return self
if _replace and key in self:
View
2  ebpub/ebpub/db/templatetags/eb_filter.py
@@ -73,7 +73,7 @@ def _get_filterchain(self, context):
# Note, context['request'] only works if
# django.core.context_processors.request is enabled in
# TEMPLATE_CONTEXT_PROCESSORS.
- filterchain = FilterChain(context=context, request=context['request'],
+ filterchain = FilterChain(context=context, request=context.get('request'),
schema=filterchain_or_schema)
else:
raise template.TemplateSyntaxError(
View
8 ebpub/ebpub/geocoder/parser/parsing.py
@@ -85,13 +85,13 @@ def __call__(self, s):
else:
return s
-_number_standardizer_re = re.compile(r'^(\d+)')
+_number_standardizer_re = re.compile(r'(\d+)')
def number_standardizer(s):
"""
Removes the second number in hyphenated addresses such as '123-02', as
used in NYC. Note that this also removes the second number in address
- ranges::
+ ranges, and non-digit prefixes or suffixes::
>>> number_standardizer('1-2')
'1'
@@ -105,6 +105,10 @@ def number_standardizer(s):
'257'
>>> number_standardizer('9L00')
'9'
+ >>> number_standardizer('W01')
+ '01'
+ >>> number_standardizer('9 8 7 6 5')
+ '9'
"""
m = _number_standardizer_re.search(s)
View
2  ebpub/ebpub/streets/bin/populate_streets.py
@@ -107,7 +107,7 @@ def intersecting_blocks(block):
return intersections
def intersection_from_blocks(block_a, block_b, intersection_pt, city, state, zip):
- obj = Intersection(
+ obj, created = Intersection.objects.get_or_create(
pretty_name=pretty_name_from_blocks(block_a, block_b),
slug=slug_from_blocks(block_a, block_b),
predir_a=block_a.predir,
View
8 obadmin/obadmin/admin/views.py
@@ -307,10 +307,14 @@ def import_items_from_spreadsheets(items_file, schema, mapping_file=None,
@csrf_protect
def import_newsitems(request):
- form = forms.ImportNewsForm(request.POST or None, request.FILES or None)
+ from ebdata.scrapers.general.spreadsheet.retrieval import get_default_unique_field_names
+ form = forms.ImportNewsForm(
+ request.POST or None, request.FILES or None,
+ initial={'unique_fields': get_default_unique_field_names()}
+ )
if form.save():
# TODO: Capture logging output and put that in message too?
- msg = u'Added %d, Updated %d, Skipped %d.' % (form.added, form.updated, form.skipped)
+ msg = u'%d added. %d updated. %d skipped or unchanged.' % (form.added, form.updated, form.skipped)
msg += u' See the server error log if you need more info.'
messages.add_message(request, messages.INFO, msg)
return HttpResponseRedirect('./')

No commit comments for this range

Something went wrong with that request. Please try again.