treequel 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ == v1.7.2 [2011-11-29] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add a workaround for Time objects used in generalizedTime fields,
4
+ since Time has a #to_ary.
5
+ - Columns down in treewhat output instead of columns across
6
+ - Fix inheritance of syntax for datatype conversion
7
+
8
+
1
9
  == v1.7.1 [2011-11-28] Michael Granger <ged@FaerieMUD.org>
2
10
 
3
11
  - Modified filter expressions to eliminate unnecessary ORing
data/bin/treewhat CHANGED
@@ -239,7 +239,7 @@ class Treequel::What
239
239
 
240
240
  pr.say( "\n" )
241
241
  pr.say( pr.color(subheading, :subheader) )
242
- pr.say( pr.list(items.sort_by(&:downcase), :columns_across) )
242
+ pr.say( pr.list(items.sort_by(&:downcase), :columns_down) )
243
243
  end
244
244
 
245
245
 
@@ -724,7 +724,8 @@ class Treequel::Branch
724
724
  value = self.entry ? self.entry[ attrsym.to_s ] : nil
725
725
 
726
726
  if attribute = self.directory.schema.attribute_types[ attrsym ]
727
- syntax_oid = attribute.syntax_oid
727
+ syntax = attribute.syntax
728
+ syntax_oid = syntax.oid if syntax
728
729
 
729
730
  if attribute.single?
730
731
  value = self.directory.convert_to_object( syntax_oid, value.first ) if value
@@ -429,6 +429,10 @@ class Treequel::Model < Treequel::Branch
429
429
  entry = self.entry || {}
430
430
  entry_values = entry.key?( attribute ) ? entry[attribute] : []
431
431
 
432
+ # Workaround for the fact that Time has a #to_ary, causing it to become an
433
+ # Array of integers when cast via Array().
434
+ values = [ values ] if values.is_a?( Time )
435
+
432
436
  values = Array( values ).compact.
433
437
  collect {|val| self.get_converted_attribute(attribute, val) }
434
438
  self.log.debug " comparing %s values to entry: %p vs. %p" %
data/lib/treequel.rb CHANGED
@@ -26,10 +26,10 @@ end
26
26
  module Treequel
27
27
 
28
28
  # Library version
29
- VERSION = '1.7.1'
29
+ VERSION = '1.7.2'
30
30
 
31
31
  # VCS revision
32
- REVISION = %q$Revision: d2ba344f87e8 $
32
+ REVISION = %q$Revision: a8a3bca987c3 $
33
33
 
34
34
  # Common paths for ldap.conf
35
35
  COMMON_LDAP_CONF_PATHS = %w[
@@ -865,6 +865,22 @@ describe Treequel::Branch do
865
865
  branch[ :ipServicePort ].should be_a( Fixnum )
866
866
  end
867
867
 
868
+ it "respects syntax inherited from supertype in object conversion" do
869
+ test_dn = "cn=authorized_users,#{TEST_HOSTS_DN}"
870
+ entry = {
871
+ 'cn' => ['authorized_users'],
872
+ 'member' => [TEST_PERSON_DN]
873
+ }
874
+ @conn.should_receive( :search_ext2 ).
875
+ with( test_dn, LDAP::LDAP_SCOPE_BASE, "(objectClass=*)" ).
876
+ and_return([ entry ])
877
+
878
+ branch = Treequel::Branch.new( @directory, test_dn )
879
+
880
+ branch[ :member ].first.should be_a( Treequel::Branch )
881
+ branch[ :member ].first.dn.should == TEST_PERSON_DN
882
+ end
883
+
868
884
  end
869
885
 
870
886
  ### Attribute writer
@@ -662,6 +662,20 @@ describe Treequel::Model do
662
662
 
663
663
  end
664
664
 
665
+ it "avoids Arrayifying Time objects when converting them to generalized time strings" do
666
+ entry = {
667
+ 'dn' => ["cn=something,#{TEST_BASE_DN}"],
668
+ 'objectClass' => ['dhcpLeases'],
669
+ 'cn' => ['something'],
670
+ 'dhcpAddressState' => ['ACTIVE'],
671
+ }
672
+ obj = Treequel::Model.new_from_entry( entry, @directory )
673
+
674
+ obj.dhcp_start_time_of_state = Time.utc( 1322607981 )
675
+
676
+ obj.modifications.should include( ldap_mod_add :dhcpStartTimeOfState, '13226079810101000000Z' )
677
+ end
678
+
665
679
  end
666
680
 
667
681
  describe "objects created in memory" do
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treequel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 1
10
- version: 1.7.1
9
+ - 2
10
+ version: 1.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-11-28 00:00:00 Z
39
+ date: 2011-11-30 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-ldap
metadata.gz.sig CHANGED
Binary file