[Rt-commit] [svn] r880 - in RTx-Atom: . html/Atom html/Atom/0.3 html/Atom/0.3/Elements

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Wed May 12 10:59:19 EDT 2004


Author: autrijus
Date: Wed May 12 10:59:18 2004
New Revision: 880

Modified:
   RTx-Atom/   (props changed)
   RTx-Atom/html/Atom/0.3/Elements/SetProperty
   RTx-Atom/html/Atom/0.3/dhandler
   RTx-Atom/html/Atom/dhandler
Log:
 ----------------------------------------------------------------------
 r4819 at not:  autrijus | 2004-05-12T14:59:03.195644Z
 
 * Support for nonutf8 encodings in Put.
 * Stop special-casing for MembersObj.
 ----------------------------------------------------------------------


Modified: RTx-Atom/html/Atom/0.3/Elements/SetProperty
==============================================================================
--- RTx-Atom/html/Atom/0.3/Elements/SetProperty	(original)
+++ RTx-Atom/html/Atom/0.3/Elements/SetProperty	Wed May 12 10:59:18 2004
@@ -3,6 +3,8 @@
 $Object->_ClassAccessible->{$Property}{read} or return(404, undef);
 $Object->_ClassAccessible->{$Property}{write} or return(403, undef);
 
+$m->notes('ToUTF8')->($Value);
+
 my $method = "Set$Property";
 my ($rv, $new_value) = ($Object->$method( $Value ))[0, -1];
 

Modified: RTx-Atom/html/Atom/0.3/dhandler
==============================================================================
--- RTx-Atom/html/Atom/0.3/dhandler	(original)
+++ RTx-Atom/html/Atom/0.3/dhandler	Wed May 12 10:59:18 2004
@@ -265,8 +265,13 @@
 	$property = $3;
 
 	if ($1) {
-	    $list->GotoItem($1);
-	    $obj = $list->Next;
+	    if ($2 > 0) {
+		$list->GotoItem($2-1);
+		$obj = $list->Next;
+	    }
+	    else {
+		undef $obj;
+	    }
 	}
 	else {
 	    $obj = $list->NewItem;
@@ -277,14 +282,10 @@
     }
     elsif ($part =~ /^([A-Z]\w*)(?:\.(\w+))?$/) {
 	$list = $obj->$1;
-	if (ref($list) eq 'RT::Group') {
-	    $list = $list->UserMembersObj;
-	}
-	else {
-	    $list->UnLimit;
-	}
-	if ( ($property = $2) ) {
+
+	if ( ($property = $2) or !$list->can('UnLimit') ) {
 	    $obj = $list;
+	    undef $list;
 	}
 	else {
 	    $property = $obj = undef;
@@ -293,11 +294,15 @@
     # Can't allow cache to happen at all
     eval { $obj->_expire( $obj->_gen_primary_cache_key()) };
 }
+
 my $resource = ($obj ? $property ? 'Property' : 'Object' : 'Container');
-$obj ||= $list->NewItem;
 
 # Can't allow cache to happen at all
-eval { $obj->_expire( $obj->_gen_primary_cache_key()) };
+eval {
+    $obj ||= $list->NewItem;
+    $obj->_expire( $obj->_gen_primary_cache_key());
+    $list->UnLimit unless $list->_isLimited;
+};
 
 if ($resource eq 'Container') {
     # FeedURI on collection
@@ -308,6 +313,16 @@
     $verb = 'Update' if $verb eq 'Add';
 }
 
+if (my $encoding = $m->notes('encoding')) {
+    $m->notes(ToUTF8 => sub {
+	Encode::_utf8_off($_[0]);
+	Encode::from_to($_[0], $encoding, 'utf-8');
+    });
+}
+else {
+    $m->notes(ToUTF8 => sub { 1 });
+}
+
 $m->comp(
     "$verb/index", %ARGS,
     Type => $type,

Modified: RTx-Atom/html/Atom/dhandler
==============================================================================
--- RTx-Atom/html/Atom/dhandler	(original)
+++ RTx-Atom/html/Atom/dhandler	Wed May 12 10:59:18 2004
@@ -1,4 +1,4 @@
-%# The main dispatcher for RT/REST 2.0
+%# The main dispatcher for RT/Atom 0.3
 <%INIT>
 $r->content_type('text/html');
 $r->header_out(Location => "$RT::WebPath/Atom/0.3/");


More information about the Rt-commit mailing list