Index: openacs-4/packages/dotlrn-homework/www/dotlrn-homework-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-homework/www/dotlrn-homework-portlet.tcl,v
diff -u -r1.4 -r1.4.2.1
--- openacs-4/packages/dotlrn-homework/www/dotlrn-homework-portlet.tcl	7 Aug 2017 23:48:10 -0000	1.4
+++ openacs-4/packages/dotlrn-homework/www/dotlrn-homework-portlet.tcl	21 Mar 2023 15:35:02 -0000	1.4.2.1
@@ -41,10 +41,22 @@
 set show_upload_url_p [expr {!$admin_p && [permission::permission_p -object_id $folder_id -privilege "write"]}]
 set admin_actions_p 0
 
-#AG: In Oracle this query is a seemingly nonsensical "select 1 from dual".
-#The problem is, the db logic in PG is completely different and requires a query.
-#To avoid propagating these differences up to Tcl we use a query in Oracle too.
-set min_level [db_string select_default_min_level {}]
+if {$folder_id == 0} {
+    #
+    # A folder_id 0 may happen in "Portal Templates" when we showcase
+    # the portal layout. We return a dummy level in this case. The
+    # portlet won't have much content anyway.
+    #
+    set min_level 0
+} {
+    #
+    # AG: In Oracle this query is a seemingly nonsensical "select 1
+    # from dual".  The problem is, the db logic in PG is completely
+    # different and requires a query.  To avoid propagating these
+    # differences up to Tcl we use a query in Oracle too.
+    #
+    set min_level [db_string select_default_min_level {}]
+}
 
 if { $admin_p } {
     # Admin view is limited to the folder name due to the fact that the admin can see every