View Issue Details

IDProjectCategoryView StatusLast Update
0030252FPCPatchpublic2017-06-17 23:52
ReporterMario Ray MahardhikaAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSlinuxOS VersionRolling release
Product Version3.1.1Product Buildsvn r33937 
Target Version3.2.0Fixed in Version3.1.1 
Summary0030252: Patch to remove the need for explicit TFPWebAction cast in user code
DescriptionThe attached patch will remove the need for explicit TFPWebAction cast when calling the following methods and properties inside a TFPWebModule descendant methods:

- Actions.Add
- Actions.ActionByName
- Actions.FindAction
- Actions[<some index>]
- Actions.CurrentAction

Existing codes that does explicit cast should still work.
TagsNo tags attached.
Fixed in Revision35623
FPCOldBugId
FPCTarget
Attached Files
  • fpc.diff (2,380 bytes)
    Index: packages/fcl-web/src/base/fpweb.pp
    ===================================================================
    --- packages/fcl-web/src/base/fpweb.pp	(revision 33937)
    +++ packages/fcl-web/src/base/fpweb.pp	(working copy)
    @@ -50,13 +50,20 @@
     
       TFPWebActions = Class(TCustomWebActions)
       private
    -    FCurrentAction : TCustomWebAction;
    +    FCurrentAction : TFPWebAction;
    +    function GetFPWebActions(Index : Integer): TFPWebAction;
    +    procedure SetFPWebActions(Index : Integer; const AValue: TFPWebAction);
       protected
         Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); virtual;
         Procedure GetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean); virtual;
    +    Function  GetRequestAction(ARequest: TRequest) : TFPWebAction;
       Public
    +    Function Add : TFPWebAction;
    +    Function ActionByName(const AName : String) : TFPWebAction;
    +    Function FindAction(const AName : String): TFPWebAction;
    +    Property FPWebActions[Index : Integer] : TFPWebAction Read GetFPWebActions Write SetFPWebActions; Default;
         Property ActionVar;
    -    Property CurrentAction: TCustomWebAction read FCurrentAction;
    +    Property CurrentAction: TFPWebAction read FCurrentAction;
       end;
     
       { TTemplateVar }
    @@ -553,10 +560,40 @@
     
     { TFPWebActions }
     
    +Function TFPWebActions.GetRequestAction(ARequest: TRequest) : TFPWebAction;
    +begin
    +  Result := inherited GetRequestAction(ARequest) as TFPWebAction;
    +end;
    +
    +Function TFPWebActions.Add : TFPWebAction;
    +begin
    +  Result := inherited Add as TFPWebAction;
    +end;
    +
    +Function TFPWebActions.ActionByName(const AName : String) : TFPWebAction;
    +begin
    +  Result := inherited ActionByName(AName) as TFPWebAction;
    +end;
    +
    +Function TFPWebActions.FindAction(const AName : String): TFPWebAction;
    +begin
    +  Result := inherited FindAction(AName) as TFPWebAction;
    +end;
    +
    +function TFPWebActions.GetFPWebActions(Index : Integer): TFPWebAction;
    +begin
    +  Result := Actions[Index] as TFPWebAction;
    +end;
    +
    +procedure TFPWebActions.SetFPWebActions(Index : Integer; const AValue: TFPWebAction);
    +begin
    +  Actions[Index] := AValue;
    +end;
    +
     procedure TFPWebActions.HandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
     
     Var
    -  A : TCustomWebAction;
    +  A : TFPWebAction;
     
     begin
     {$ifdef cgidebug}SendMethodEnter('FPWebActions.handlerequest');{$endif cgidebug}
    
    fpc.diff (2,380 bytes)

Activities

Mario Ray Mahardhika

2016-06-09 01:16

reporter  

fpc.diff (2,380 bytes)
Index: packages/fcl-web/src/base/fpweb.pp
===================================================================
--- packages/fcl-web/src/base/fpweb.pp	(revision 33937)
+++ packages/fcl-web/src/base/fpweb.pp	(working copy)
@@ -50,13 +50,20 @@
 
   TFPWebActions = Class(TCustomWebActions)
   private
-    FCurrentAction : TCustomWebAction;
+    FCurrentAction : TFPWebAction;
+    function GetFPWebActions(Index : Integer): TFPWebAction;
+    procedure SetFPWebActions(Index : Integer; const AValue: TFPWebAction);
   protected
     Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean); virtual;
     Procedure GetContent(ARequest : TRequest; Content : TStream; Var Handled : Boolean); virtual;
+    Function  GetRequestAction(ARequest: TRequest) : TFPWebAction;
   Public
+    Function Add : TFPWebAction;
+    Function ActionByName(const AName : String) : TFPWebAction;
+    Function FindAction(const AName : String): TFPWebAction;
+    Property FPWebActions[Index : Integer] : TFPWebAction Read GetFPWebActions Write SetFPWebActions; Default;
     Property ActionVar;
-    Property CurrentAction: TCustomWebAction read FCurrentAction;
+    Property CurrentAction: TFPWebAction read FCurrentAction;
   end;
 
   { TTemplateVar }
@@ -553,10 +560,40 @@
 
 { TFPWebActions }
 
+Function TFPWebActions.GetRequestAction(ARequest: TRequest) : TFPWebAction;
+begin
+  Result := inherited GetRequestAction(ARequest) as TFPWebAction;
+end;
+
+Function TFPWebActions.Add : TFPWebAction;
+begin
+  Result := inherited Add as TFPWebAction;
+end;
+
+Function TFPWebActions.ActionByName(const AName : String) : TFPWebAction;
+begin
+  Result := inherited ActionByName(AName) as TFPWebAction;
+end;
+
+Function TFPWebActions.FindAction(const AName : String): TFPWebAction;
+begin
+  Result := inherited FindAction(AName) as TFPWebAction;
+end;
+
+function TFPWebActions.GetFPWebActions(Index : Integer): TFPWebAction;
+begin
+  Result := Actions[Index] as TFPWebAction;
+end;
+
+procedure TFPWebActions.SetFPWebActions(Index : Integer; const AValue: TFPWebAction);
+begin
+  Actions[Index] := AValue;
+end;
+
 procedure TFPWebActions.HandleRequest(ARequest: TRequest; AResponse: TResponse; Var Handled : Boolean);
 
 Var
-  A : TCustomWebAction;
+  A : TFPWebAction;
 
 begin
 {$ifdef cgidebug}SendMethodEnter('FPWebActions.handlerequest');{$endif cgidebug}
fpc.diff (2,380 bytes)

Michael Van Canneyt

2017-03-18 20:39

administrator   ~0099031

Finally found time to apply. Thanks for the contribution!

Issue History

Date Modified Username Field Change
2016-06-09 01:16 Mario Ray Mahardhika New Issue
2016-06-09 01:16 Mario Ray Mahardhika File Added: fpc.diff
2016-06-09 08:25 Michael Van Canneyt Assigned To => Michael Van Canneyt
2016-06-09 08:25 Michael Van Canneyt Status new => assigned
2017-03-18 20:39 Michael Van Canneyt Fixed in Revision => 35623
2017-03-18 20:39 Michael Van Canneyt Note Added: 0099031
2017-03-18 20:39 Michael Van Canneyt Status assigned => resolved
2017-03-18 20:39 Michael Van Canneyt Fixed in Version => 3.1.1
2017-03-18 20:39 Michael Van Canneyt Resolution open => fixed
2017-03-18 20:39 Michael Van Canneyt Target Version => 3.2.0
2017-06-17 23:52 Mario Ray Mahardhika Status resolved => closed