<commit_before># -*- coding: utf-8 -*-
##
##
## This file is part of CDS Indico.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
##
## CDS Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

from persistent import Persistent
from MaKaC.common.db import DBMgr
from MaKaC.common.logger import Logger
from MaKaC.common.httpTimeout import urlOpenWithTimeout
from MaKaC.errors import MaKaCError
from urllib2 import HTTPError, URLError
from BaseHTTPServer import BaseHTTPRequestHandler
from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools

class WebcastManager(Persistent):
    """Holds and manages general information about webcasts in the system
    """

    def __init__(self):
        self.channels = []
#        self._requested_webcasts = []
        self._archived_webcasts = []
        self._forthcoming_webcasts = []
        self._managers = []
        self._webcastSynchronizationURL = '' #used for automatic synchronization

    def getManagers( self ):
        try:
            return self._managers
        except:
            self._managers = []
            return self._managers

    def addManager( self, av ):
        if av not in self.getManagers():
            self._managers.append(av)
            self._p_changed=1

    def removeManager( self, av ):
        if av in self.getManagers():
            self._managers.remove( av )
            self._p_changed=1

    def isManager( self, av ):
        if av in self.getManagers():
            return True
        else:
            return False

    def getChannels(self):
        return self.channels

    def getChannel(self, name):
        for ch in self.channels:
            if ch.getName() == name:
                return ch
        return None

#    def addRequestedWebcast(self, event ):
#        if not self.getRequestedWebcast(event):
#            if event:
#                wc = Webcast(event)
#                self._requested_webcasts.append(wc)
#                self._p_changed=1
#
#    def getRequestedWebcast(self, event):
#        for wc in self._requested_webcasts:
#            if wc.getEvent() == event:
#                return wc
#        return None
#
#    def getRequestedWebcasts(self):
#        return self._requested_webcasts
#
#    def acceptRequestedWebcast(self, webcast):
#        for wc in self._requested_webcasts:
#            if wc == webcast:
#                self._requested_webcasts.remove(webcast)
#                if not self.getForthcomingWebcast(webcast.getEvent()):
#                    self._forthcoming_webcasts.append(webcast)
#                self._p_changed=1
#
#    def deleteRequestedWebcast(self, webcast):
#        for wc in self._requested_webcasts:
#            if wc == webcast:
#                self._requested_webcasts.remove(webcast)
#                self._p_changed=1

    def addForthcomingWebcast( self, event, audience=""):
        wc = self.getForthcomingWebcast(event)
        if not wc:
            if event:
                wc = Webcast(event, audience)
                self._forthcoming_webcasts.append(wc)
                self._p_changed=1
                self.remoteSynchronize()
        else:
            wc.setAudience(audience)

    def delForthcomingWebcast(self, event):
        wc = self.getForthcomingWebcast(event)
        if wc and wc in self._forthcoming_webcasts:
            self._forthcoming_webcasts.remove(wc)

    def getForthcomingWebcast(self, event):
        for wc in self._forthcoming_webcasts:
            if wc.getEvent() == event:
                return wc
        return None<commit_msg>[FIX] Adding p_changed to prev commit<commit_after># -*- coding: utf-8 -*-
##
##
## This file is part of CDS Indico.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
##
## CDS Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

from persistent import Persistent
from MaKaC.common.db import DBMgr
from MaKaC.common.logger import Logger
from MaKaC.common.httpTimeout import urlOpenWithTimeout
from MaKaC.errors import MaKaCError
from urllib2 import HTTPError, URLError
from BaseHTTPServer import BaseHTTPRequestHandler
from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools

class WebcastManager(Persistent):
    """Holds and manages general information about webcasts in the system
    """

    def __init__(self):
        self.channels = []
#        self._requested_webcasts = []
        self._archived_webcasts = []
        self._forthcoming_webcasts = []
        self._managers = []
        self._webcastSynchronizationURL = '' #used for automatic synchronization

    def getManagers( self ):
        try:
            return self._managers
        except:
            self._managers = []
            return self._managers

    def addManager( self, av ):
        if av not in self.getManagers():
            self._managers.append(av)
            self._p_changed=1

    def removeManager( self, av ):
        if av in self.getManagers():
            self._managers.remove( av )
            self._p_changed=1

    def isManager( self, av ):
        if av in self.getManagers():
            return True
        else:
            return False

    def getChannels(self):
        return self.channels

    def getChannel(self, name):
        for ch in self.channels:
            if ch.getName() == name:
                return ch
        return None

#    def addRequestedWebcast(self, event ):
#        if not self.getRequestedWebcast(event):
#            if event:
#                wc = Webcast(event)
#                self._requested_webcasts.append(wc)
#                self._p_changed=1
#
#    def getRequestedWebcast(self, event):
#        for wc in self._requested_webcasts:
#            if wc.getEvent() == event:
#                return wc
#        return None
#
#    def getRequestedWebcasts(self):
#        return self._requested_webcasts
#
#    def acceptRequestedWebcast(self, webcast):
#        for wc in self._requested_webcasts:
#            if wc == webcast:
#                self._requested_webcasts.remove(webcast)
#                if not self.getForthcomingWebcast(webcast.getEvent()):
#                    self._forthcoming_webcasts.append(webcast)
#                self._p_changed=1
#
#    def deleteRequestedWebcast(self, webcast):
#        for wc in self._requested_webcasts:
#            if wc == webcast:
#                self._requested_webcasts.remove(webcast)
#                self._p_changed=1

    def addForthcomingWebcast( self, event, audience=""):
        wc = self.getForthcomingWebcast(event)
        if not wc:
            if event:
                wc = Webcast(event, audience)
                self._forthcoming_webcasts.append(wc)
                self._p_changed=1
                self.remoteSynchronize()
        else:
            wc.setAudience(audience)

    def delForthcomingWebcast(self, event):
        wc = self.getForthcomingWebcast(event)
        if wc and wc in self._forthcoming_webcasts:
            self._forthcoming_webcasts.remove(wc)
            self._p_changed = 1

    def getForthcomingWebcast(self, event):
        for wc in self._forthcoming_webcasts:
            if wc.getEvent() == event:
                return wc
        return None
{'fraction_non_alphanumeric': 0.08354907036949871, 'fraction_numerical': 0.011179100964932926, 'mean_word_length': 2.325117370892019, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6851615', 'n_tokens_mistral': 2561, 'n_tokens_neox': 2361, 'n_words': 718}