Explorar o código

Add getObjectId()

Pascal Peridont %!s(int64=17) %!d(string=hai) anos
pai
achega
f1c0524424
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      std/mtwin/web/Handler.hx

+ 8 - 2
std/mtwin/web/Handler.hx

@@ -70,13 +70,19 @@ class Handler<T> {
 	function initialize() {
 	}
 
+	function getObjectId( part:String ) : Int {
+		if (~/^[0-9]+$/.match(part))
+			return Std.parseInt(part);
+		return null;
+	}
+
 	public function execute( request:Request, ?pathLevel:Int ){
 		if (pathLevel == null)
 			pathLevel = 0;
 
 		var part = request.getPathInfoPart(pathLevel);
-		if (~/^[0-9]+$/.match(part)){
-			id = Std.parseInt(part);
+		this.id = getObjectId(part);
+		if( id != null ){
 			part = request.getPathInfoPart(++pathLevel);
 			if (part == "")
 				part = OBJECT_DEFAULT;