diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-06-16 10:30:46 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-06-16 10:30:46 +0100 |
commit | d5812d4f687c1dbe5513fde85969eecb0a87a9b8 (patch) | |
tree | ad940008d4fea55aa8bc54e466ddd1193e188923 /lib | |
parent | 170b2508e9e07e4b430d25c6f4d7ae3930caa07d (diff) | |
parent | 42870985da06418461c847563fa860c11b4094a1 (diff) |
Merge branch 'replace-xxx-todo' into rails-3-develop
Diffstat (limited to 'lib')
-rw-r--r-- | lib/acts_as_xapian/acts_as_xapian.rb | 18 | ||||
-rw-r--r-- | lib/alaveteli_file_types.rb | 8 | ||||
-rw-r--r-- | lib/has_tag_string/has_tag_string.rb | 4 | ||||
-rw-r--r-- | lib/mail_handler/backends/mail_backend.rb | 2 | ||||
-rw-r--r-- | lib/mail_handler/mail_handler.rb | 4 | ||||
-rw-r--r-- | lib/strip_attributes/strip_attributes.rb | 2 |
6 files changed, 19 insertions, 19 deletions
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb index b30bb4d10..168d2eec3 100644 --- a/lib/acts_as_xapian/acts_as_xapian.rb +++ b/lib/acts_as_xapian/acts_as_xapian.rb @@ -24,7 +24,7 @@ end module ActsAsXapian ###################################################################### # Module level variables - # XXX must be some kind of cattr_accessor that can do this better + # TODO: must be some kind of cattr_accessor that can do this better def ActsAsXapian.bindings_available $acts_as_xapian_bindings_available end @@ -109,12 +109,12 @@ module ActsAsXapian @@db_path = File.join(db_parent_path, environment) # make some things that don't depend on the db - # XXX this gets made once for each acts_as_xapian. Oh well. + # TODO: this gets made once for each acts_as_xapian. Oh well. @@stemmer = Xapian::Stem.new('english') end # Opens / reopens the db for reading - # XXX we perhaps don't need to rebuild database and enquire and queryparser - + # TODO: we perhaps don't need to rebuild database and enquire and queryparser - # but db.reopen wasn't enough by itself, so just do everything it's easier. def ActsAsXapian.readable_init raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed") unless ActsAsXapian.bindings_available @@ -188,7 +188,7 @@ module ActsAsXapian raise "Z is reserved for stemming terms" if term[1] == "Z" raise "Already have code '" + term[1] + "' in another model but with different prefix '" + @@terms_by_capital[term[1]] + "'" if @@terms_by_capital.include?(term[1]) && @@terms_by_capital[term[1]] != term[2] @@terms_by_capital[term[1]] = term[2] - # XXX use boolean here so doesn't stem our URL names in WhatDoTheyKnow + # TODO: use boolean here so doesn't stem our URL names in WhatDoTheyKnow # If making acts_as_xapian generic, would really need to make the :terms have # another option that lets people choose non-boolean for terms that need it # (i.e. searching explicitly within a free text field) @@ -231,7 +231,7 @@ module ActsAsXapian raise "acts_as_xapian hasn't been called in any models" if @@init_values.empty? # if DB is not nil, then we're already initialised, so don't do it - # again XXX reopen it each time, xapian_spec.rb needs this so database + # again TODO: reopen it each time, xapian_spec.rb needs this so database # gets written twice correctly. # return unless @@writable_db.nil? @@ -510,7 +510,7 @@ module ActsAsXapian # Find the documents by their unique term input_models_query = Xapian::Query.new(Xapian::Query::OP_OR, query_models.map{|m| "I" + m.xapian_document_term}) ActsAsXapian.enquire.query = input_models_query - matches = ActsAsXapian.enquire.mset(0, 100, 100) # XXX so this whole method will only work with 100 docs + matches = ActsAsXapian.enquire.mset(0, 100, 100) # TODO: so this whole method will only work with 100 docs # Get set of relevant terms for those documents selection = Xapian::RSet.new() @@ -601,7 +601,7 @@ module ActsAsXapian begin if job.action == 'update' - # XXX Index functions may reference other models, so we could eager load here too? + # TODO: Index functions may reference other models, so we could eager load here too? model = job.model.constantize.find(job.model_id) # :include => cls.constantize.xapian_options[:include] model.xapian_index elsif job.action == 'destroy' @@ -717,7 +717,7 @@ module ActsAsXapian ActiveRecord::Base.connection.disconnect! - pid = Process.fork # XXX this will only work on Unix, tough + pid = Process.fork # TODO: this will only work on Unix, tough if pid Process.waitpid(pid) if not $?.success? @@ -898,7 +898,7 @@ module ActsAsXapian ActsAsXapian.term_generator.document = doc for text in texts_to_index ActsAsXapian.term_generator.increase_termpos # stop phrases spanning different text fields - # XXX the "1" here is a weight that could be varied for a boost function + # TODO: the "1" here is a weight that could be varied for a boost function ActsAsXapian.term_generator.index_text(xapian_value(text, nil, true), 1) end end diff --git a/lib/alaveteli_file_types.rb b/lib/alaveteli_file_types.rb index e89bc0c78..617048c05 100644 --- a/lib/alaveteli_file_types.rb +++ b/lib/alaveteli_file_types.rb @@ -16,15 +16,15 @@ class AlaveteliFileTypes "tnef" => 'application/ms-tnef', "tif" => 'image/tiff', "gif" => 'image/gif', - "jpg" => 'image/jpeg', # XXX add jpeg + "jpg" => 'image/jpeg', # TODO: add jpeg "png" => 'image/png', "bmp" => 'image/bmp', - "html" => 'text/html', # XXX add htm + "html" => 'text/html', # TODO: add htm "vcf" => 'text/x-vcard', "zip" => 'application/zip', "delivery-status" => 'message/delivery-status' } - # XXX doesn't have way of choosing default for inverse map - might want to add + # TODO: doesn't have way of choosing default for inverse map - might want to add # one when you need it FileExtensionToMimeTypeRev = FileExtensionToMimeType.invert @@ -46,7 +46,7 @@ class AlaveteliFileTypes m = Mahoro.new(Mahoro::MIME) mahoro_type = m.buffer(content) mahoro_type.strip! - # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :( + # TODO: we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :( # e.g. for InfoRequestEvent 17930 if mahoro_type.nil? || mahoro_type.empty? return nil diff --git a/lib/has_tag_string/has_tag_string.rb b/lib/has_tag_string/has_tag_string.rb index 4022faaac..c28720f04 100644 --- a/lib/has_tag_string/has_tag_string.rb +++ b/lib/has_tag_string/has_tag_string.rb @@ -10,7 +10,7 @@ module HasTagString # Represents one tag of one model. # The migration to make this is currently only in WDTK code. class HasTagStringTag < ActiveRecord::Base - # XXX strip_attributes! + # TODO: strip_attributes! validates_presence_of :name @@ -46,7 +46,7 @@ module HasTagString # Methods which are added to the model instances being tagged module InstanceMethods # Given an input string of tags, sets all tags to that string. - # XXX This immediately saves the new tags. + # TODO: This immediately saves the new tags. def tag_string=(tag_string) if tag_string.nil? tag_string = "" diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb index e019eba97..190e79e97 100644 --- a/lib/mail_handler/backends/mail_backend.rb +++ b/lib/mail_handler/backends/mail_backend.rb @@ -323,7 +323,7 @@ module MailHandler end end end - # XXX call _convert_part_body_to_text here, but need to get charset somehow + # TODO: call _convert_part_body_to_text here, but need to get charset somehow # e.g. http://www.whatdotheyknow.com/request/1593/response/3088/attach/4/Freedom%20of%20Information%20request%20-%20car%20oval%20sticker:%20Article%2020,%20Convention%20on%20Road%20Traffic%201949.txt body = headers + "\n" + body end diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb index 53033d440..47015f207 100644 --- a/lib/mail_handler/mail_handler.rb +++ b/lib/mail_handler/mail_handler.rb @@ -70,7 +70,7 @@ module MailHandler # note re. charset: TMail always tries to convert email bodies # to UTF8 by default, so normally it should already be that. text = '' - # XXX - tell all these command line tools to return utf-8 + # TODO: - tell all these command line tools to return utf-8 if content_type == 'text/plain' text += body + "\n\n" else @@ -151,7 +151,7 @@ module MailHandler body = entry.get_input_stream.read rescue # move to next attachment silently if there were problems - # XXX really should reduce this to specific exceptions? + # TODO: really should reduce this to specific exceptions? # e.g. password protected next end diff --git a/lib/strip_attributes/strip_attributes.rb b/lib/strip_attributes/strip_attributes.rb index 130d10185..12350277d 100644 --- a/lib/strip_attributes/strip_attributes.rb +++ b/lib/strip_attributes/strip_attributes.rb @@ -1,6 +1,6 @@ module StripAttributes # Strips whitespace from model fields and leaves nil values as nil. - # XXX this differs from official StripAttributes, as it doesn't make blank cells null. + # TODO: this differs from official StripAttributes, as it doesn't make blank cells null. def strip_attributes!(options = nil) before_validation do |record| attribute_names = StripAttributes.narrow(record.attribute_names, options) |