예제 #1
0
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################
"""
Restricted zipfile module.

From restricted python, use "import zipfile" (see patches/Restricted.py).
"""
from six import string_types as basestring
from AccessControl import allow_class as _allow_class
from zExceptions import Unauthorized
import zipfile as _zipfile

BadZipfile = _zipfile.BadZipfile
_allow_class(BadZipfile)
LargeZipFile = _zipfile.LargeZipFile
_allow_class(LargeZipFile)

ZIP64_LIMIT = _zipfile.ZIP64_LIMIT
ZIP_FILECOUNT_LIMIT = _zipfile.ZIP_FILECOUNT_LIMIT
ZIP_MAX_COMMENT = _zipfile.ZIP_MAX_COMMENT

ZIP_STORED = _zipfile.ZIP_STORED
ZIP_DEFLATED = _zipfile.ZIP_DEFLATED

ZipInfo = _zipfile.ZipInfo
_allow_class(ZipInfo)
ZipExtFile = _zipfile.ZipExtFile
_allow_class(ZipExtFile)
예제 #2
0
파일: ZipFile.py 프로젝트: MarkTang/erp5
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################
"""
Restricted zipfile module.

From restricted python, use "import zipfile" (see patches/Restricted.py).
"""
from AccessControl import allow_class as _allow_class
from zExceptions import Unauthorized
import zipfile as _zipfile

BadZipfile = _zipfile.BadZipfile
_allow_class(BadZipfile)
LargeZipFile = _zipfile.LargeZipFile
_allow_class(LargeZipFile)

ZIP64_LIMIT = _zipfile.ZIP64_LIMIT
ZIP_FILECOUNT_LIMIT = _zipfile.ZIP_FILECOUNT_LIMIT
ZIP_MAX_COMMENT = _zipfile.ZIP_MAX_COMMENT

ZIP_STORED = _zipfile.ZIP_STORED
ZIP_DEFLATED = _zipfile.ZIP_DEFLATED

ZipInfo = _zipfile.ZipInfo
_allow_class(ZipInfo)
ZipExtFile = _zipfile.ZipExtFile
_allow_class(ZipExtFile)
예제 #3
0
def _disallowed(*args, **kw):
  raise Unauthorized

prcal = _disallowed
prmonth = _disallowed

IllegalMonthError = _calendar.IllegalMonthError
IllegalWeekdayError = _calendar.IllegalWeekdayError
calendar = _calendar.calendar
firstweekday = _calendar.firstweekday
isleap = _calendar.isleap
leapdays = _calendar.leapdays
month = _calendar.month
monthcalendar = _calendar.monthcalendar
monthrange = _calendar.monthrange
setfirstweekday = _calendar.setfirstweekday
timegm = _calendar.timegm
weekday = _calendar.weekday

Calendar = _calendar.Calendar
_allow_class(Calendar)

HTMLCalendar = _calendar.HTMLCalendar
_allow_class(HTMLCalendar)

class TextCalendar(_calendar.TextCalendar):
  prweek = _disallowed
  prmonth = _disallowed
  pryear = _disallowed
_allow_class(TextCalendar)