Server IP : 85.214.239.14 / Your IP : 3.145.175.50 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/root/proc/2/root/proc/2/cwd/srv/modoboa/env/lib64/python3.5/site-packages/icalendar/ |
Upload File : |
# -*- coding: utf-8 -*- from datetime import datetime from icalendar.parser_tools import to_unicode from icalendar.prop import vDatetime from icalendar.prop import vText from string import ascii_letters from string import digits import random class UIDGenerator(object): """If you are too lazy to create real uid's. """ chars = list(ascii_letters + digits) def rnd_string(self, length=16): """Generates a string with random characters of length. """ return ''.join([random.choice(self.chars) for _ in range(length)]) def uid(self, host_name='example.com', unique=''): """Generates a unique id consisting of: datetime-uniquevalue@host. Like: 20050105T225746Z-HKtJMqUgdO0jDUwm@example.com """ host_name = to_unicode(host_name) unique = unique or self.rnd_string() today = to_unicode(vDatetime(datetime.today()).to_ical()) return vText('%s-%s@%s' % (today, unique, host_name))