Code review comment for lp:~brian-murray/oops-repository/bucketsystems

Revision history for this message
Brian Murray (brian-murray) wrote :

On Thu, Feb 07, 2013 at 06:22:23PM -0000, Evan Dandrea wrote:
> On Thu, Feb 7, 2013 at 6:11 PM, Brian Murray <email address hidden> wrote:
> > +def update_bucket_systems(config, bucket, system):
> > + pool = connection_pool(config)
> > + bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketSystems')
> > + try:
> > + systems = bucketsystems_cf.get(bucket)
> > + if system not in systems:
> > + bucketsystems_cf.insert(bucket, {system: ''})
> > + except NotFoundException:
> > + bucketsystems_cf.insert(bucket, {system: ''})
>
> Shouldn't this just be bucketsystems_cf.insert() without the try block
> or get() method? If there are already columns in bucketsystems_cf,
> calling insert() will just update the column with that system
> identifier.

Ah, I hadn't thought about that. I'll go ahead and test that then,
thanks.

--
Brian Murray

« Back to merge proposal