예제 #1
0
    def packArgs(self, kwargs):
        keys = set(kwargs.keys()).union(set(TkObject.DEFAULT_PACK_ARGS.keys()))
        d = {k: kwargs.get(k, TkObject.DEFAULT_PACK_ARGS.get(k)) for k in keys}

        self._packArgs = Namespace(**d)
        self._isPacked = True

        # layout our parent
        if self.parent is not None:
            self.parent.rearrangeChildren()
예제 #2
0
    def __init__(self, obj, parent=None):
        self.obj = obj
        self.parent = parent

        self._repr = describe(obj)

        self._children = []
        self._isPacked = False

        # NB: must NOT use the seter
        self._packArgs = Namespace(**TkObject.DEFAULT_PACK_ARGS)
예제 #3
0
    SignupCodeType,
    UserTaskPreference,
)

from .common import validate_consistent_keys, award_view_model_translation, task_preferences_model_translation
from .org import OrganizationService
from .proj import ProjectService
from .notifications import NotificationDomain, NotificationService

# Namespace declaration #

# TODO: continue/extend experiment with Namespaces over *Services

# User domain #

UserDomain = Namespace('user')


@UserDomain
def query_pending_volunteer_profiles(user):
    ensure_rule('volunteer.new_user_review', user)

    return (VolunteerProfile.objects.filter(
        volunteer_status=ReviewStatus.NEW).order_by('is_edited',
                                                    '-creation_date'))


@UserDomain
def query_signup_codes_by_text(code_name):
    if not code_name:
        return None
예제 #4
0
from namespaces import Namespace

from .user import UserDomain

marketplace = MarketplaceDomain = Namespace('marketplace')

MarketplaceDomain._add_(UserDomain)
예제 #5
0
from django.conf import settings
from django.core.mail import send_mail

from namespaces import Namespace

from marketplace.models.user import UserNotification

LOG = logging.getLogger(__name__)

# Namespace declaration #

# TODO: continue/extend experiment with Namespaces over *Services

# Notification domain #

NotificationDomain = Namespace('notification')


@NotificationDomain
def add_user_notification(user, notification_description, severity, source,
                          target_id):
    notification = UserNotification.objects.create(
        user=user,
        notification_description=notification_description,
        severity=severity,
        source=source,
        target_id=target_id,
        is_read=False,
    )

    if user.email:
예제 #6
0
#!/usr/bin/python2.2
import random, tramp, rdflib.TripleStore as rts, cgi
from namespaces import rss, rdf, Namespace
import cgitb; cgitb.enable()
x=cgi.FieldStorage()
if x.has_key("url"): url = x["url"].value
else: url = "http://swordfish.rdfweb.org/calendar/events/swevents.rss"

ev = Namespace("http://purl.org/rss/1.0/modules/event/")

store = rts.TripleStore()
store.load(url)
channel = tramp.Thing(list(store.triples(None, rdf.type, rss.channel))[0][0], store)
print "Content-type: text/plain"
print
print """BEGIN:VCALENDAR
VERSION
 :2.0
PRODID
 :PRODID:-//hacksw/rss2ical.py//NONSGML v1.0//EN"""

for item in channel[rss.items]:
    print "BEGIN:VEVENT\nUID\n :" + str(random.randint(1,100000))
    print "SUMMARY\n :" + item[rss.title]
    print "DTSTART\n :" + item[ev.startdate].replace("-", "")
    print "DTEND\b :" + item[ev.enddate].replace("-", "")
    print "END:VEVENT"

print "END:VCALENDAR"